From: terencehill Date: Thu, 24 Mar 2022 17:55:33 +0000 (+0100) Subject: Show "No weapons" if no valid weapon can be found in g_weaponarena X-Git-Tag: xonotic-v0.8.5~81^2~12 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=90273463aea21a23bfd5083479db8f2eba0e963c;p=xonotic%2Fxonotic-data.pk3dir.git Show "No weapons" if no valid weapon can be found in g_weaponarena --- diff --git a/qcsrc/server/world.qc b/qcsrc/server/world.qc index 7fce21e6e..ac0c17c8e 100644 --- a/qcsrc/server/world.qc +++ b/qcsrc/server/world.qc @@ -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 {