]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Improve client side weapon arena options parsing
authorterencehill <piuntn@gmail.com>
Fri, 1 Apr 2022 13:02:38 +0000 (15:02 +0200)
committerterencehill <piuntn@gmail.com>
Fri, 1 Apr 2022 13:02:38 +0000 (15:02 +0200)
qcsrc/client/main.qc
qcsrc/menu/xonotic/dialog_multiplayer_create_mutators.qc

index c7f4d576c73d7b61a8bec8da38e8ff4f30c31223..3c3b5bc7e8fff7cf40eb4ec86e16d3c12dbe332a 100644 (file)
@@ -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)
index d35415df6606f9c951fbf7e34609243509808797..564ffc5ae578e37bea3e8ddf63adc35c39b4522c 100644 (file)
@@ -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);