From: Mario Date: Sun, 21 Aug 2016 14:53:24 +0000 (+1000) Subject: Add an intrusive list for saved cvars X-Git-Tag: xonotic-v0.8.2~663^2~16 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=20990dd00925cef8d5fdd917fbc6feeb961f4cf5;p=xonotic%2Fxonotic-data.pk3dir.git Add an intrusive list for saved cvars --- diff --git a/qcsrc/common/util.qc b/qcsrc/common/util.qc index 716abaf98..47c4f4c20 100644 --- a/qcsrc/common/util.qc +++ b/qcsrc/common/util.qc @@ -600,7 +600,7 @@ float cvar_settemp(string tmp_cvar, string tmp_value) return 0; } - FOREACH_ENTITY_CLASS("saved_cvar_value", it.netname == tmp_cvar, + IL_EACH("saved_cvar_value", it.netname == tmp_cvar, { created_saved_value = -1; // skip creation break; // no need to continue @@ -610,6 +610,7 @@ float cvar_settemp(string tmp_cvar, string tmp_value) { // creating a new entity to keep track of this cvar entity e = new_pure(saved_cvar_value); + IL_PUSH(g_saved_cvars, e); e.netname = strzone(tmp_cvar); e.message = strzone(cvar_string(tmp_cvar)); created_saved_value = 1; diff --git a/qcsrc/common/util.qh b/qcsrc/common/util.qh index 9e1d5a75b..90e2152d0 100644 --- a/qcsrc/common/util.qh +++ b/qcsrc/common/util.qh @@ -5,6 +5,9 @@ vector real_origin(entity ent); #endif +IntrusiveList g_saved_cvars; +STATIC_INIT(g_saved_cvars) { g_saved_cvars = IL_NEW(); } + // this returns a tempstring containing a copy of s with additional \n newlines added, it also replaces \n in the text with a real newline // NOTE: s IS allowed to be a tempstring string wordwrap(string s, float l);