]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
New loop for new toys
authorMario <mario@smbclan.net>
Wed, 23 Dec 2015 23:43:26 +0000 (09:43 +1000)
committerMario <mario@smbclan.net>
Wed, 23 Dec 2015 23:43:26 +0000 (09:43 +1000)
qcsrc/common/mutators/mutator/new_toys/new_toys.qc

index 20a9d94f5452c6c5d63885e2f6de5ced4baaa890..2f4510a3fd971badc9e6a3edd38864c416cf58c4 100644 (file)
@@ -77,16 +77,18 @@ REGISTER_MUTATOR(nt, cvar("g_new_toys") && !cvar("g_instagib") && !cvar("g_overk
                        error("This cannot be added at runtime\n");
 
                // mark the guns as ok to use by e.g. impulse 99
-               for(int i = WEP_FIRST; i <= WEP_LAST; ++i)
-                       if(nt_IsNewToy(i))
-                               Weapons_from(i).spawnflags &= ~WEP_FLAG_MUTATORBLOCKED;
+               FOREACH(Weapons, it != WEP_Null, LAMBDA(
+                       if(nt_IsNewToy(it.m_id))
+                               it.spawnflags &= ~WEP_FLAG_MUTATORBLOCKED;
+               ));
        }
 
        MUTATOR_ONROLLBACK_OR_REMOVE
        {
-               for(int i = WEP_FIRST; i <= WEP_LAST; ++i)
-                       if(nt_IsNewToy(i))
-                               Weapons_from(i).spawnflags |= WEP_FLAG_MUTATORBLOCKED;
+               FOREACH(Weapons, it != WEP_Null, LAMBDA(
+                       if(nt_IsNewToy(it.m_id))
+                               it.spawnflags |= WEP_FLAG_MUTATORBLOCKED;
+               ));
        }
 
        MUTATOR_ONREMOVE