From 20990dd00925cef8d5fdd917fbc6feeb961f4cf5 Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 22 Aug 2016 00:53:24 +1000 Subject: [PATCH] Add an intrusive list for saved cvars --- qcsrc/common/util.qc | 3 ++- qcsrc/common/util.qh | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) 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); -- 2.39.2