From d40d588f6d7cf866f7de41db9efffdd6c1a05135 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Wed, 29 Dec 2021 18:14:01 +0000 Subject: Make convar init macro type-generic This removes the need to call atof() on each cvar on plugin load; now all that's required is the memory allocations for the string values. The syntax is also a bit nicer since numbers can just be numbers rather than quoted strings. Minor issue: specifying a string value that also happens to be numeric will break this since the numeric representation will be zero, but I can't see a reason this would ever happen. Also, add a DEF_CVAR_MAX just for completeness. --- src/demorec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/demorec.c') diff --git a/src/demorec.c b/src/demorec.c index c4ac504..dda692f 100644 --- a/src/demorec.c +++ b/src/demorec.c @@ -49,8 +49,8 @@ static int nbits_datalen; static int auto_demonum = 1; static bool auto_recording = false; -DEF_CVAR(sst_autorecord, "Continue recording demos through map changes", - "1", CON_ARCHIVE | CON_HIDDEN) +DEF_CVAR(sst_autorecord, "Continue recording demos through map changes", 1, + CON_ARCHIVE | CON_HIDDEN) static void VCALLCONV hook_StopRecording(void *this) { // This hook will get called twice per loaded save (in most games/versions, -- cgit v1.2.3