hedgewars/uConsole.pas
changeset 2747 7889a3a9724f
parent 2699 249adefa9c1c
child 2786 85f6425a4d74
equal deleted inserted replaced
2746:55593f8a490b 2747:7889a3a9724f
    31 procedure WriteToConsole(s: shortstring);
    31 procedure WriteToConsole(s: shortstring);
    32 procedure WriteLnToConsole(s: shortstring);
    32 procedure WriteLnToConsole(s: shortstring);
    33 procedure ParseCommand(CmdStr: shortstring; TrustedSource: boolean);
    33 procedure ParseCommand(CmdStr: shortstring; TrustedSource: boolean);
    34 procedure StopMessages(Message: Longword);
    34 procedure StopMessages(Message: Longword);
    35 function  GetLastConsoleLine: shortstring;
    35 function  GetLastConsoleLine: shortstring;
    36 procedure SplitBySpace(var a, b: shortstring);
       
    37 
    36 
    38 procedure doPut(putX, putY: LongInt; fromAI: boolean);
    37 procedure doPut(putX, putY: LongInt; fromAI: boolean);
    39 
    38 
    40 implementation
    39 implementation
    41 uses uMisc, uStore, Types, uConsts, uGears, uTeams, uIO, uKeys, uWorld, uLand,
    40 uses uMisc, uStore, Types, uConsts, uGears, uTeams, uIO, uKeys, uWorld, uLand,
    95       begin
    94       begin
    96       t:= tt;
    95       t:= tt;
    97       tt:= tt^.Next;
    96       tt:= tt^.Next;
    98       Dispose(t)
    97       Dispose(t)
    99       end;
    98       end;
   100 end;
       
   101 
       
   102 procedure SplitBySpace(var a, b: shortstring);
       
   103 var i, t: LongInt;
       
   104 begin
       
   105 i:= Pos(' ', a);
       
   106 if i > 0 then
       
   107 	begin
       
   108 	for t:= 1 to Pred(i) do
       
   109 		if (a[t] >= 'A')and(a[t] <= 'Z') then Inc(a[t], 32);
       
   110 	b:= copy(a, i + 1, Length(a) - i);
       
   111 	byte(a[0]):= Pred(i)
       
   112 	end else b:= '';
       
   113 end;
    99 end;
   114 
   100 
   115 procedure WriteToConsole(s: shortstring);
   101 procedure WriteToConsole(s: shortstring);
   116 var Len: LongInt;
   102 var Len: LongInt;
   117     done: boolean;
   103     done: boolean;
   316 	RegisterVariable('-cur_d'  , vtCommand, @chCurD_m       , true );
   302 	RegisterVariable('-cur_d'  , vtCommand, @chCurD_m       , true );
   317 	RegisterVariable('+cur_l'  , vtCommand, @chCurL_p       , true );
   303 	RegisterVariable('+cur_l'  , vtCommand, @chCurL_p       , true );
   318 	RegisterVariable('-cur_l'  , vtCommand, @chCurL_m       , true );
   304 	RegisterVariable('-cur_l'  , vtCommand, @chCurL_m       , true );
   319 	RegisterVariable('+cur_r'  , vtCommand, @chCurR_p       , true );
   305 	RegisterVariable('+cur_r'  , vtCommand, @chCurR_p       , true );
   320 	RegisterVariable('-cur_r'  , vtCommand, @chCurR_m       , true );
   306 	RegisterVariable('-cur_r'  , vtCommand, @chCurR_m       , true );
       
   307 	RegisterVariable('flag'    , vtCommand, @chFlag         , false);
   321 end;
   308 end;
   322 
   309 
   323 procedure free_uConsole;
   310 procedure free_uConsole;
   324 begin
   311 begin
   325 	FreeVariablesList();
   312 	FreeVariablesList();