]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/util.qc
Merge branch 'master' into mirio/balance
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / util.qc
index 427bdb84b4662b7d2347b1c190f84102589cb4b5..a087c9faa07851db1bb0134161223772de880381 100644 (file)
@@ -624,6 +624,8 @@ float cvar_settemp(string tmp_cvar, string tmp_value)
 int cvar_settemp_restore()
 {
        int j = 0;
+       // FIXME this new-style loop fails!
+#if 0
        FOREACH_ENTITY_CLASS("saved_cvar_value", true,
        {
                if(cvar_type(it.netname))
@@ -638,6 +640,21 @@ int cvar_settemp_restore()
                        LOG_INFOF("Error: cvar %s doesn't exist anymore! It can still be restored once it's manually recreated.\n", it.netname);
        });
 
+#else
+       entity e = world;
+       while((e = find(e, classname, "saved_cvar_value")))
+       {
+               if(cvar_type(e.netname))
+               {
+                       cvar_set(e.netname, e.message);
+                       remove(e);
+                       ++j;
+               }
+               else
+                       print(sprintf("Error: cvar %s doesn't exist anymore! It can still be restored once it's manually recreated.\n", e.netname));
+       }
+#endif
+
        return j;
 }