]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add an intrusive list for saved cvars
authorMario <mario@smbclan.net>
Sun, 21 Aug 2016 14:53:24 +0000 (00:53 +1000)
committerMario <mario@smbclan.net>
Sun, 21 Aug 2016 14:53:24 +0000 (00:53 +1000)
qcsrc/common/util.qc
qcsrc/common/util.qh

index 716abaf9880f183d47d9a82cd8c3af52e9b0eeb4..47c4f4c2079255f64640899eae734a6293e89bec 100644 (file)
@@ -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;
index 9e1d5a75be3f94cf418fca7aecb9e4459d28aa44..90e2152d0179f17336bf7a7b1a1546fac3948cb5 100644 (file)
@@ -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);