--- a/hedgewars/uCommands.pas Wed Jun 29 18:09:24 2011 +0200
+++ b/hedgewars/uCommands.pas Fri Jul 01 08:46:47 2011 +0200
@@ -33,7 +33,7 @@
procedure StopMessages(Message: Longword);
implementation
-uses Types, uConsts, uVariables, uConsole, uUtils, uDebug;
+uses Types, uConsts, uVariables, uConsole, uUtils, uDebug, uScript;
type PVariable = ^TVariable;
TVariable = record
@@ -68,7 +68,7 @@
procedure ParseCommand(CmdStr: shortstring; TrustedSource: boolean);
var ii: LongInt;
- s: shortstring;
+ s, i, o: shortstring;
t: PVariable;
c: char;
begin
@@ -85,6 +85,8 @@
if t^.Name = CmdStr then
begin
if TrustedSource or t^.Trusted then
+ begin
+ if (c <> '$') or (s[0] <> #0) then s:= ParseCommandOverride(CmdStr, s);
case t^.VType of
vtCommand: if c='/' then
begin
@@ -94,8 +96,12 @@
if s[0]=#0 then
begin
str(PLongInt(t^.Handler)^, s);
- WriteLnToConsole('$' + CmdStr + ' is "' + s + '"');
- end else val(s, PLongInt(t^.Handler)^);
+ i:= inttostr(PLongInt(t^.Handler)^);
+ o:= ParseCommandOverride(CmdStr, i);
+ if i <> o then val(o, PLongInt(t^.Handler)^)
+ else WriteLnToConsole('$' + CmdStr + ' is "' + s + '"');
+ end
+ else val(s, PLongInt(t^.Handler)^);
vthwFloat: if c='$' then
if s[0]=#0 then
begin
@@ -106,13 +112,23 @@
if s[0]=#0 then
begin
str(ord(boolean(t^.Handler^)), s);
- WriteLnToConsole('$' + CmdStr + ' is "' + s + '"');
- end else
+ if boolean(t^.Handler^) then i:= '1'
+ else i:= '0';
+ o:= ParseCommandOverride(CmdStr, i);
+ if i <> o then
+ begin
+ val(o, ii);
+ boolean(t^.Handler^):= not (ii = 0)
+ end
+ else WriteLnToConsole('$' + CmdStr + ' is "' + s + '"');
+ end
+ else
begin
val(s, ii);
boolean(t^.Handler^):= not (ii = 0)
end;
end;
+ end;
exit
end else t:= t^.Next
end;