]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Loopify weapon arena string
authorMario <mario@smbclan.net>
Wed, 23 Dec 2015 23:53:51 +0000 (09:53 +1000)
committerMario <mario@smbclan.net>
Wed, 23 Dec 2015 23:54:07 +0000 (09:54 +1000)
qcsrc/menu/xonotic/dialog_multiplayer_create_mutators.qc

index 8b9ddf9b252860304e03ad6fb96c5dc2131547d0..e45e9595f0dab1624789b376588320237521f965 100644 (file)
@@ -28,8 +28,7 @@ string weaponarenastring_cvar;
 string WeaponArenaString()
 {
        string s;
-       float n, i, j;
-       entity e;
+       float n, i;
        s = cvar_string("g_weaponarena");
        if(s == "0")
                return "";
@@ -50,12 +49,10 @@ string WeaponArenaString()
        s = "";
        for(i = 0; i < n; ++i)
        {
-               for(j = WEP_FIRST; j <= WEP_LAST; ++j)
-               {
-                       e = Weapons_from(j);
-                       if(argv(i) == e.netname)
-                               s = strcat(s, " & ", e.m_name);
-               }
+               FOREACH(Weapons, it != WEP_Null, LAMBDA(
+                       if(argv(i) == it.netname)
+                               s = strcat(s, " & ", it.m_name);
+               ));
        }
        s = sprintf(_("%s Arena"), substring(s, 3, strlen(s) - 3));