summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5c79a5c)
raw | patch | inline | side by side (parent: 5c79a5c)
author | Stas'M <x86corez@gmail.com> | |
Thu, 25 Jul 2019 17:20:13 +0000 (20:20 +0300) | ||
committer | Stas'M <x86corez@gmail.com> | |
Thu, 25 Jul 2019 17:20:13 +0000 (20:20 +0300) |
src/game/g_console.pas | patch | blob | history |
diff --git a/src/game/g_console.pas b/src/game/g_console.pas
index 6f02743bb8f73df2221dee5749139db5d82dcdee..c89e3eeb0d9dc9de301403935ea06ef01deff1fb 100644 (file)
--- a/src/game/g_console.pas
+++ b/src/game/g_console.pas
procedure boolVarHandler (me: PCommand; p: SSArray);
procedure binaryFlag (var flag: Boolean; msg: AnsiString);
+ var
+ old: Boolean;
begin
if (Length(p) > 2) then
begin
end
else
begin
+ old := flag;
case conGetBoolArg(p, 1) of
-1: begin end;
0: if not me.cheat or conIsCheatsEnabled then flag := false else begin conwriteln('not available'); exit; end;
1: if not me.cheat or conIsCheatsEnabled then flag := true else begin conwriteln('not available'); exit; end;
666: if not me.cheat or conIsCheatsEnabled then flag := not flag else begin conwriteln('not available'); exit; end;
end;
+ if flag <> old then
+ g_Console_WriteGameConfig();
if (Length(msg) = 0) then msg := p[0] else msg += ':';
if flag then conwritefln('%s tan', [msg]) else conwritefln('%s ona', [msg]);
end;
procedure intVarHandler (me: PCommand; p: SSArray);
+var
+ old: Integer;
begin
if (Length(p) <> 2) then
begin
else
begin
try
+ old := PInteger(me.ptr)^;
PInteger(me.ptr)^ := StrToInt(p[1]);
+ if PInteger(me.ptr)^ <> old then
+ g_Console_WriteGameConfig();
except
conwritefln('invalid integer value: "%s"', [p[1]]);
end;
procedure singleVarHandler (me: PCommand; p: SSArray);
var
pv: PVarSingle;
- nv: Single;
+ nv, old: Single;
msg: AnsiString;
begin
if (Length(p) > 2) then
exit;
end;
pv := PVarSingle(me.ptr);
+ old := pv.val^;
if (Length(p) = 2) then
begin
if me.cheat and (not conIsCheatsEnabled) then begin conwriteln('not available'); exit; end;
pv.val^ := nv;
end;
end;
+ if pv.val^ <> old then
+ g_Console_WriteGameConfig();
msg := me.msg;
if (Length(msg) = 0) then msg := me.cmd else msg += ':';
conwritefln('%s %s', [msg, pv.val^]);