Parameters for GlobalInvite event, the values are used only if Prevent is true (that is, handler succeeded and no further processing is performed).
Every handler should check Prevent property and perform its actions only if it's equal to false. That ensures only one handler succeeds.
Inheritance: CritterChainEventArgs
 // called by engine
 bool RaiseGlobalInvite(Item car, uint encounter_descriptor, int combat_mode,
                        ref uint map_id, ref ushort hx, ref ushort hy, ref byte dir)
 {
     if (GlobalInvite != null)
     {
         var e = new CritterGlobalInviteEventArgs(this, car, encounter_descriptor, combat_mode)
         {
             MapId = map_id,
             HexX  = hx,
             HexY  = hy,
             Dir   = (Direction)dir
         };
         GlobalInvite(this, e);
         // extract (only if some handler intercepted)
         if (e.Prevent)
         {
             map_id = e.MapId;
             hx     = e.HexX;
             hy     = e.HexY;
             dir    = (byte)e.Dir;
         }
         return(e.Prevent);
     }
     return(false);
 }
Exemple #2
0
 // called by engine
 bool RaiseGlobalInvite(Item car, uint encounter_descriptor, int combat_mode,
     ref uint map_id, ref ushort hx, ref ushort hy, ref byte dir)
 {
     if (GlobalInvite != null)
     {
         var e = new CritterGlobalInviteEventArgs(this, car, encounter_descriptor, combat_mode)
         {
             MapId = map_id,
             HexX = hx,
             HexY = hy,
             Dir = (Direction)dir
         };
         GlobalInvite(this, e);
         // extract (only if some handler intercepted)
         if (e.Prevent)
         {
             map_id = e.MapId;
             hx = e.HexX;
             hy = e.HexY;
             dir = (byte)e.Dir;
         }
         return e.Prevent;
     }
     return false;
 }