hedgewars/uCommands.pas
changeset 7805 2a249a4faf5b
parent 7426 55b49cc1f33a
child 7806 c27713b5e052
equal deleted inserted replaced
7804:9122461ae32b 7805:2a249a4faf5b
    21 unit uCommands;
    21 unit uCommands;
    22 
    22 
    23 interface
    23 interface
    24 
    24 
    25 var isDeveloperMode: boolean;
    25 var isDeveloperMode: boolean;
       
    26 var isExternalSource: boolean;
    26 type TCommandHandler = procedure (var params: shortstring);
    27 type TCommandHandler = procedure (var params: shortstring);
    27 
    28 
    28 procedure initModule;
    29 procedure initModule;
    29 procedure freeModule;
    30 procedure freeModule;
    30 procedure RegisterVariable(Name: shortstring; p: TCommandHandler; Trusted: boolean; Rand: boolean);
    31 procedure RegisterVariable(Name: shortstring; p: TCommandHandler; Trusted: boolean; Rand: boolean);
    31 procedure RegisterVariable(Name: shortstring; p: TCommandHandler; Trusted: boolean);
    32 procedure RegisterVariable(Name: shortstring; p: TCommandHandler; Trusted: boolean);
    32 procedure ParseCommand(CmdStr: shortstring; TrustedSource: boolean);
    33 procedure ParseCommand(CmdStr: shortstring; TrustedSource: boolean); inline;
       
    34 procedure ParseCommand(CmdStr: shortstring; TrustedSource, ExternalSource: boolean);
    33 procedure ParseTeamCommand(s: shortstring);
    35 procedure ParseTeamCommand(s: shortstring);
    34 procedure StopMessages(Message: Longword);
    36 procedure StopMessages(Message: Longword);
    35 
    37 
    36 implementation
    38 implementation
    37 uses uConsts, uVariables, uConsole, uUtils, uDebug, SDLh;
    39 uses uConsts, uVariables, uConsole, uUtils, uDebug, SDLh;
    71     Variables:= value
    73     Variables:= value
    72     end;
    74     end;
    73 end;
    75 end;
    74 
    76 
    75 
    77 
    76 procedure ParseCommand(CmdStr: shortstring; TrustedSource: boolean);
    78 procedure ParseCommand(CmdStr: shortstring; TrustedSource: boolean); inline;
       
    79 begin
       
    80     ParseCommand(CmdStr, TrustedSource, false)
       
    81 end;
       
    82 
       
    83 procedure ParseCommand(CmdStr: shortstring; TrustedSource, ExternalSource: boolean);
    77 var s: shortstring;
    84 var s: shortstring;
    78     t: PVariable;
    85     t: PVariable;
    79     c: char;
    86     c: char;
    80 begin
    87 begin
       
    88 isExternalSource:= ExternalSource or CurrentTeam^.ExtDriven;
    81 //WriteLnToConsole(CmdStr);
    89 //WriteLnToConsole(CmdStr);
    82 if CmdStr[0]=#0 then
    90 if CmdStr[0]=#0 then
    83     exit;
    91     exit;
    84 c:= CmdStr[1];
    92 c:= CmdStr[1];
    85 if (c = '/') or (c = '$') then
    93 if (c = '/') or (c = '$') then