hedgewars/uCommands.pas
changeset 6919 bf7433e62b9c
parent 6898 344b0dbd9690
child 6923 d2405a6a86f5
equal deleted inserted replaced
6918:13d6cce2056c 6919:bf7433e62b9c
    27 
    27 
    28 procedure initModule;
    28 procedure initModule;
    29 procedure freeModule;
    29 procedure freeModule;
    30 procedure RegisterVariable(Name: shortstring; p: TCommandHandler; Trusted: boolean);
    30 procedure RegisterVariable(Name: shortstring; p: TCommandHandler; Trusted: boolean);
    31 procedure ParseCommand(CmdStr: shortstring; TrustedSource: boolean);
    31 procedure ParseCommand(CmdStr: shortstring; TrustedSource: boolean);
       
    32 procedure ParseTeamCommand(s: shortstring);
    32 procedure StopMessages(Message: Longword);
    33 procedure StopMessages(Message: Longword);
    33 
    34 
    34 implementation
    35 implementation
    35 uses Types, uConsts, uVariables, uConsole, uUtils, uDebug;
    36 uses Types, uConsts, uVariables, uConsole, uUtils, uDebug;
    36 
    37 
    97     '$': WriteLnToConsole(errmsgUnknownVariable + ': "$' + CmdStr + '"')
    98     '$': WriteLnToConsole(errmsgUnknownVariable + ': "$' + CmdStr + '"')
    98     else
    99     else
    99         WriteLnToConsole(errmsgUnknownCommand  + ': "/' + CmdStr + '"') end
   100         WriteLnToConsole(errmsgUnknownCommand  + ': "/' + CmdStr + '"') end
   100 end;
   101 end;
   101 
   102 
       
   103 procedure ParseTeamCommand(s: shortstring);
       
   104 var Trusted: boolean;
       
   105 begin
       
   106 Trusted:= (CurrentTeam <> nil)
       
   107           and (not CurrentTeam^.ExtDriven)
       
   108           and (CurrentHedgehog^.BotLevel = 0);
       
   109 ParseCommand(s, Trusted);
       
   110 if (CurrentTeam <> nil) and (not CurrentTeam^.ExtDriven) and (ReadyTimeLeft > 1) then
       
   111     ParseCommand('gencmd R', true)
       
   112 end;
       
   113 
       
   114 
   102 
   115 
   103 procedure StopMessages(Message: Longword);
   116 procedure StopMessages(Message: Longword);
   104 begin
   117 begin
   105 if (Message and gmLeft) <> 0 then
   118 if (Message and gmLeft) <> 0 then
   106     ParseCommand('/-left', true)
   119     ParseCommand('/-left', true)