hedgewars/uConsole.pas
changeset 495 62c1c2b4414c
parent 415 d6d3a6a473a3
child 539 6a9bf1852bbc
equal deleted inserted replaced
494:503758a35c02 495:62c1c2b4414c
   154 for i:= 0 to Pred(cLinesCount) do PLongWord(@ConsoleLines[i])^:= 0
   154 for i:= 0 to Pred(cLinesCount) do PLongWord(@ConsoleLines[i])^:= 0
   155 end;
   155 end;
   156 
   156 
   157 procedure ParseCommand(CmdStr: shortstring; TrustedSource: boolean);
   157 procedure ParseCommand(CmdStr: shortstring; TrustedSource: boolean);
   158 type PhwFloat = ^hwFloat;
   158 type PhwFloat = ^hwFloat;
   159 var i, ii: LongInt;
   159 var ii: LongInt;
   160     s: shortstring;
   160     s: shortstring;
   161     t: PVariable;
   161     t: PVariable;
   162     c: char;
   162     c: char;
   163 begin
   163 begin
   164 //WriteLnToConsole(CmdStr);
   164 //WriteLnToConsole(CmdStr);
   181               vtLongInt: if c='$' then
   181               vtLongInt: if c='$' then
   182                          if s[0]=#0 then
   182                          if s[0]=#0 then
   183                             begin
   183                             begin
   184                             str(PLongInt(t^.Handler)^, s);
   184                             str(PLongInt(t^.Handler)^, s);
   185                             WriteLnToConsole('$' + CmdStr + ' is "' + s + '"');
   185                             WriteLnToConsole('$' + CmdStr + ' is "' + s + '"');
   186                             end else val(s, PLongInt(t^.Handler)^, i);
   186                             end else val(s, PLongInt(t^.Handler)^);
   187                  vthwFloat: if c='$' then
   187               vthwFloat: if c='$' then
   188                          if s[0]=#0 then
   188                          if s[0]=#0 then
   189                             begin
   189                             begin
   190                             //str(PhwFloat(t^.Handler)^:4:6, s);
   190                             //str(PhwFloat(t^.Handler)^:4:6, s);
   191                             WriteLnToConsole('$' + CmdStr + ' is "' + s + '"');
   191                             WriteLnToConsole('$' + CmdStr + ' is "' + s + '"');
   192                             end else; //val(s, PhwFloat(t^.Handler)^, i);
   192                             end else; //val(s, PhwFloat(t^.Handler)^, i);
   195                             begin
   195                             begin
   196                             str(ord(boolean(t^.Handler^)), s);
   196                             str(ord(boolean(t^.Handler^)), s);
   197                             WriteLnToConsole('$' + CmdStr + ' is "' + s + '"');
   197                             WriteLnToConsole('$' + CmdStr + ' is "' + s + '"');
   198                             end else
   198                             end else
   199                             begin
   199                             begin
   200                             val(s, ii, i);
   200                             val(s, ii);
   201                             boolean(t^.Handler^):= not (ii = 0)
   201                             boolean(t^.Handler^):= not (ii = 0)
   202                             end;
   202                             end;
   203               end;
   203               end;
   204          exit
   204          exit
   205          end else t:= t^.Next
   205          end else t:= t^.Next