hedgewars/uConsole.pas
changeset 2695 ed789a7ef68d
parent 2630 079ef82eac75
child 2699 249adefa9c1c
equal deleted inserted replaced
2694:dcd248e04f3d 2695:ed789a7ef68d
    63 with tl do
    63 with tl do
    64      s:= str;
    64      s:= str;
    65 end;
    65 end;
    66 
    66 
    67 function RegisterVariable(Name: string; VType: TVariableType; p: pointer; Trusted: boolean): PVariable;
    67 function RegisterVariable(Name: string; VType: TVariableType; p: pointer; Trusted: boolean): PVariable;
    68 var Result: PVariable;
    68 var value: PVariable;
    69 begin
    69 begin
    70 New(Result);
    70 New(value);
    71 TryDo(Result <> nil, 'RegisterVariable: Result = nil', true);
    71 TryDo(value <> nil, 'RegisterVariable: value = nil', true);
    72 FillChar(Result^, sizeof(TVariable), 0);
    72 FillChar(value^, sizeof(TVariable), 0);
    73 Result^.Name:= Name;
    73 value^.Name:= Name;
    74 Result^.VType:= VType;
    74 value^.VType:= VType;
    75 Result^.Handler:= p;
    75 value^.Handler:= p;
    76 Result^.Trusted:= Trusted;
    76 value^.Trusted:= Trusted;
    77 
    77 
    78 if Variables = nil then Variables:= Result
    78 if Variables = nil then Variables:= value
    79                    else begin
    79                    else begin
    80                         Result^.Next:= Variables;
    80                         value^.Next:= Variables;
    81                         Variables:= Result
    81                         Variables:= value
    82                         end;
    82                         end;
    83 
    83 
    84 RegisterVariable:= Result
    84 RegisterVariable:= value;
    85 end;
    85 end;
    86 
    86 
    87 procedure FreeVariablesList;
    87 procedure FreeVariablesList;
    88 var t, tt: PVariable;
    88 var t, tt: PVariable;
    89 begin
    89 begin
   199      '$': WriteLnToConsole(errmsgUnknownVariable + ': "$' + CmdStr + '"')
   199      '$': WriteLnToConsole(errmsgUnknownVariable + ': "$' + CmdStr + '"')
   200      else WriteLnToConsole(errmsgUnknownCommand  + ': "/' + CmdStr + '"') end
   200      else WriteLnToConsole(errmsgUnknownCommand  + ': "/' + CmdStr + '"') end
   201 end;
   201 end;
   202 
   202 
   203 function GetLastConsoleLine: shortstring;
   203 function GetLastConsoleLine: shortstring;
   204 var Result: shortstring;
   204 var valueStr: shortstring;
   205 	i: LongWord;
   205 	i: LongWord;
   206 begin
   206 begin
   207 i:= (CurrLine + cLinesCount - 2) mod cLinesCount;
   207 i:= (CurrLine + cLinesCount - 2) mod cLinesCount;
   208 Result:= ConsoleLines[i].s;
   208 valueStr:= ConsoleLines[i].s;
   209 
   209 
   210 Result:= Result + #10;
   210 valueStr:= valueStr + #10;
   211 
   211 
   212 i:= (CurrLine + cLinesCount - 1) mod cLinesCount;
   212 i:= (CurrLine + cLinesCount - 1) mod cLinesCount;
   213 Result:= Result + ConsoleLines[i].s;
   213 valueStr:= valueStr + ConsoleLines[i].s;
   214 
   214 
   215 GetLastConsoleLine:= Result
   215 GetLastConsoleLine:= valueStr;
   216 end;
   216 end;
   217 
   217 
   218 procedure StopMessages(Message: Longword);
   218 procedure StopMessages(Message: Longword);
   219 begin
   219 begin
   220 if (Message and gm_Left) <> 0 then ParseCommand('/-left', true) else
   220 if (Message and gm_Left) <> 0 then ParseCommand('/-left', true) else