]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Show "No weapons" if no valid weapon can be found in g_weaponarena
authorterencehill <piuntn@gmail.com>
Thu, 24 Mar 2022 17:55:33 +0000 (18:55 +0100)
committerterencehill <piuntn@gmail.com>
Thu, 24 Mar 2022 17:56:07 +0000 (18:56 +0100)
qcsrc/server/world.qc

index 7fce21e6ee81f69fe4a35112daaec00739e22ccc..ac0c17c8e71d98386f7fb17026d7a4460b6c6e2b 100644 (file)
@@ -1937,7 +1937,10 @@ void readplayerstartcvars()
                                g_weaponarena_list = strcat(g_weaponarena_list, wep.m_name, " & ");
                        }
                }
-               g_weaponarena_list = strzone(substring(g_weaponarena_list, 0, strlen(g_weaponarena_list) - 3));
+               if (g_weaponarena_list != "") // remove trailing " & "
+                       g_weaponarena_list = substring(g_weaponarena_list, 0, strlen(g_weaponarena_list) - 3);
+               else // no valid weapon found
+                       g_weaponarena_list = "No Weapons";
        }
 
        if (g_weaponarena)
@@ -1945,6 +1948,7 @@ void readplayerstartcvars()
                g_weapon_stay = 0; // incompatible
                start_weapons = g_weaponarena_weapons;
                start_items |= IT_UNLIMITED_AMMO | IT_UNLIMITED_SUPERWEAPONS;
+               g_weaponarena_list = strzone(g_weaponarena_list);
        }
        else
        {