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/build/cmeta.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/build') diff --git a/src/build/cmeta.c b/src/build/cmeta.c index b895253..157ba92 100644 --- a/src/build/cmeta.c +++ b/src/build/cmeta.c @@ -201,7 +201,7 @@ void cmeta_conmacros(const struct cmeta *cm, void (*cb)(const char *, bool)) { bool isplusminus = false, isvar = false; if (equal(tp, "DEF_CCMD_PLUSMINUS")) isplusminus = true; else if (equal(tp, "DEF_CVAR") || equal(tp, "DEF_CVAR_MIN") || - equal(tp, "DEF_CVAR_MINMAX")) { + equal(tp, "DEF_CVAR_MAX") || equal(tp, "DEF_CVAR_MINMAX")) { isvar = true; } else if (!equal(tp, "DEF_CCMD") && !equal(tp, "DEF_CCMD_HERE")) { -- cgit v1.2.3