From: terencehill Date: Fri, 1 Apr 2022 13:02:38 +0000 (+0200) Subject: Improve client side weapon arena options parsing X-Git-Tag: xonotic-v0.8.5~81^2~3 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=96e2d933ebe37c9f9acd52027edc91d2a185c4b6;p=xonotic%2Fxonotic-data.pk3dir.git Improve client side weapon arena options parsing --- diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index c7f4d576c..3c3b5bc7e 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -1323,11 +1323,11 @@ string translate_weaponarena(string s) { if (s == "") return s; if (s == "All Weapons Arena") return _("All Weapons Arena"); - if (s == "Dev All Weapons Arena") return s; // development option, do not translate - if (s == "Most Weapons Arena") return _("Most Weapons Arena"); if (s == "All Available Weapons Arena") return _("All Available Weapons Arena"); - if (s == "Dev All Available Weapons Arena") return s; // development option, do not translate + if (s == "Most Weapons Arena") return _("Most Weapons Arena"); if (s == "Most Available Weapons Arena") return _("Most Available Weapons Arena"); + if (s == "Dev All Weapons Arena") return s; // development option, do not translate + if (s == "Dev All Available Weapons Arena") return s; // development option, do not translate if (s == "No Weapons Arena") return _("No Weapons Arena"); int n = tokenizebyseparator(s, " & "); @@ -1339,7 +1339,10 @@ string translate_weaponarena(string s) LOG_INFO("^3Warning: ^7server sent an invalid weapon name\n"); wpn_list = cons_mid(wpn_list, " & ", wep.m_name); } - return sprintf(_("%s Arena"), wpn_list); + if (wpn_list != "") + return sprintf(_("%s Arena"), wpn_list); + else + return _("No Weapons Arena"); } string GetVersionMessage(string hostversion, bool version_mismatch, bool version_check) diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_create_mutators.qc b/qcsrc/menu/xonotic/dialog_multiplayer_create_mutators.qc index d35415df6..564ffc5ae 100644 --- a/qcsrc/menu/xonotic/dialog_multiplayer_create_mutators.qc +++ b/qcsrc/menu/xonotic/dialog_multiplayer_create_mutators.qc @@ -22,12 +22,13 @@ string WeaponArenaString() string s; float n; s = cvar_string("g_weaponarena"); - if(s == "0") - return ""; - if(s == "all" || s == "1") - return _("All Weapons Arena"); - if(s == "most") - return _("Most Weapons Arena"); + if(s == "0" || s == "") return ""; + if(s == "all" || s == "1") return _("All Weapons Arena"); + if(s == "all_available") return _("All Available Weapons Arena"); + if(s == "most") return _("Most Weapons Arena"); + if(s == "most_available") return _("Most Available Weapons Arena"); + if(s == "devall") return "Dev All Weapons Arena"; // development option, do not translate + if(s == "devall_available") return "Dev All Available Weapons Arena"; // development option, do not translate if(s == weaponarenastring_cvar) return weaponarenastring; @@ -43,7 +44,10 @@ string WeaponArenaString() s = cons_mid(s, " & ", wep.m_name); } } - s = sprintf(_("%s Arena"), s); + if (s != "") + s = sprintf(_("%s Arena"), s); + else + s = _("No Weapons Arena"); strcpy(weaponarenastring, s);