summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f9175c3)
raw | patch | inline | side by side (parent: f9175c3)
author | fgsfds <pvt.fgsfds@gmail.com> | |
Mon, 2 Sep 2019 18:53:47 +0000 (21:53 +0300) | ||
committer | fgsfds <pvt.fgsfds@gmail.com> | |
Mon, 2 Sep 2019 18:53:47 +0000 (21:53 +0300) |
src/game/g_console.pas | patch | blob | history |
diff --git a/src/game/g_console.pas b/src/game/g_console.pas
index 5953403c7dd3aa4f4e714d7e1a99de1e927fb770..47239783b94865e4625d9580479e87d3488c8f68 100644 (file)
--- a/src/game/g_console.pas
+++ b/src/game/g_console.pas
procedure conRegVar (const conname: AnsiString; pvar: PBoolean; const ahelp: AnsiString; const amsg: AnsiString; acheat: Boolean=false; ahidden: Boolean=false); overload;
procedure conRegVar (const conname: AnsiString; pvar: PSingle; amin, amax: Single; const ahelp: AnsiString; const amsg: AnsiString; acheat: Boolean=false; ahidden: Boolean=false); overload;
procedure conRegVar (const conname: AnsiString; pvar: PInteger; const ahelp: AnsiString; const amsg: AnsiString; acheat: Boolean=false; ahidden: Boolean=false); overload;
+procedure conRegVar (const conname: AnsiString; pvar: PAnsiString; const ahelp: AnsiString; const amsg: AnsiString; acheat: Boolean=false; ahidden: Boolean=false); overload;
// <0: no arg; 0/1: true/false
function conGetBoolArg (p: SSArray; idx: Integer): Integer;
end;
+procedure strVarHandler (me: PCommand; p: SSArray);
+var
+ old: AnsiString;
+begin
+ if (Length(p) <> 2) then
+ begin
+ conwritefln('%s %s', [me.cmd, PAnsiString(me.ptr)^]);
+ end
+ else
+ begin
+ old := PAnsiString(me.ptr)^;
+ PAnsiString(me.ptr)^ := p[1];
+ if PAnsiString(me.ptr)^ <> old then
+ g_Console_WriteGameConfig();
+ end;
+end;
+
+
procedure conRegVar (const conname: AnsiString; pvar: PBoolean; const ahelp: AnsiString; const amsg: AnsiString; acheat: Boolean=false; ahidden: Boolean=false); overload;
var
f: Integer;
end;
+procedure conRegVar (const conname: AnsiString; pvar: PAnsiString; const ahelp: AnsiString; const amsg: AnsiString; acheat: Boolean=false; ahidden: Boolean=false); overload;
+var
+ f: Integer;
+ cp: PCommand;
+begin
+ f := Length(commands);
+ SetLength(commands, f+1);
+ cp := @commands[f];
+ cp.cmd := LowerCase(conname);
+ cp.proc := nil;
+ cp.procEx := strVarHandler;
+ cp.help := ahelp;
+ cp.hidden := ahidden;
+ cp.ptr := pvar;
+ cp.msg := amsg;
+ cp.cheat := acheat;
+ cp.action := -1;
+ cp.player := -1;
+end;
+
// ////////////////////////////////////////////////////////////////////////// //
type
PVarSingle = ^TVarSingle;