]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/xonotic/statslist.qc
Player stats in the menu: clean up translatable strings by removing untranslatable...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / statslist.qc
index 3e94738a9ab500d89a162003be58ef67106e49f0..3f9dc410b3c53ceb17b0e931997ab3ca6b30a837 100644 (file)
@@ -100,21 +100,21 @@ void XonoticStatsList_getStats(entity me)
                        case "overall/last_seen_dt":
                        {
                                order = 1;
-                               outstr = _("Last_Seen:");
+                               outstr = _("Last seen:");
                                data = XonoticStatsList_convertDate(car(data));
                                break;
                        }
                        case "overall/alivetime":
                        {
                                order = 1;
-                               outstr = _("Time_Played:");
+                               outstr = _("Time played:");
                                data = process_time(3, stof(data));
                                break;
                        }
                        case "overall/favorite-map":
                        {
                                order = 2;
-                               outstr = _("Favorite_Map:");
+                               outstr = _("Favorite map:");
                                data = car(data);
                                break;
                        }
@@ -146,13 +146,13 @@ void XonoticStatsList_getStats(entity me)
 
                if((order == -1) && (out_total_matches >= 0) && (out_total_wins >= 0))
                {
-                       bufstr_add(me.listStats, sprintf("003Matches: %d", out_total_matches), true);
+                       bufstr_add(me.listStats, sprintf("003%s\n%d", _("Matches:"), out_total_matches), true);
 
                        if(out_total_matches > 0) // don't show extra info if there are no matches played
                        {
                                out_total_losses = max(0, (out_total_matches - out_total_wins));
-                               bufstr_add(me.listStats, sprintf("003Wins/Losses: %d/%d", out_total_wins, out_total_losses), true);
-                               bufstr_add(me.listStats, sprintf("004Win_Percentage: %d%%", ((out_total_wins / out_total_matches) * 100)), true);
+                               bufstr_add(me.listStats, sprintf("003%s\n%d/%d", _("Wins/Losses:"), out_total_wins, out_total_losses), true);
+                               bufstr_add(me.listStats, sprintf("004%s\n%d%%", _("Win percentage:"), ((out_total_wins / out_total_matches) * 100)), true);
                        }
 
                        out_total_matches = -1;
@@ -163,13 +163,13 @@ void XonoticStatsList_getStats(entity me)
 
                if((order == -1) && (out_total_kills >= 0) && (out_total_deaths >= 0))
                {
-                       bufstr_add(me.listStats, sprintf("005Kills/Deaths: %d/%d", out_total_kills, out_total_deaths), true);
+                       bufstr_add(me.listStats, sprintf("005%s\n%d/%d", _("Kills/Deaths:"), out_total_kills, out_total_deaths), true);
 
                        // if there are no deaths, just show kill count
-                       if(out_total_deaths > 0)
-                               bufstr_add(me.listStats, sprintf("006Kill_Ratio: %.2f", (out_total_kills / out_total_deaths)), true);
-                       else
-                               bufstr_add(me.listStats, sprintf("006Kill_Ratio: %.2f", out_total_kills), true);
+                       if(out_total_deaths == 0)
+                               out_total_deaths = 1;
+
+                       bufstr_add(me.listStats, sprintf("006%s\n%.2f", _("Kill ratio:"), (out_total_kills / out_total_deaths)), true);
 
                        out_total_kills = -1;
                        out_total_deaths = -1;
@@ -198,28 +198,27 @@ void XonoticStatsList_getStats(entity me)
                                        case "matches":
                                        {
                                                order = 1;
-                                               outstr = sprintf(_("%s_Matches:"), strtoupper(gametype));
-                                               //data = sprintf(_("%d (unranked)"), data);
+                                               outstr = _("Matches:");
                                                break;
                                        }
                                        case "elo":
                                        {
                                                order = 2;
-                                               outstr = sprintf(_("%s_ELO:"), strtoupper(gametype));
+                                               outstr = _("ELO:");
                                                data = sprintf("%d", stof(data));
                                                break;
                                        }
                                        case "rank":
                                        {
                                                order = 3;
-                                               outstr = sprintf(_("%s_Rank:"), strtoupper(gametype));
+                                               outstr = _("Rank:");
                                                data = sprintf("%d", stof(data));
                                                break;
                                        }
                                        case "percentile":
                                        {
                                                order = 4;
-                                               outstr = sprintf(_("%s_Percentile:"), strtoupper(gametype));
+                                               outstr = _("Percentile:");
                                                data = sprintf("%d%%", stof(data));
                                                break;
                                        }
@@ -228,8 +227,7 @@ void XonoticStatsList_getStats(entity me)
                                        case "favorite-map":
                                        {
                                                order = 5;
-                                               outstr = sprintf(_("%s_Favorite_Map:"), strtoupper(gametype));
-                                               //data = sprintf(_("%d (unranked)"), data);
+                                               outstr = _("Favorite map:");
                                                break;
                                        }
                                        #endif
@@ -237,12 +235,14 @@ void XonoticStatsList_getStats(entity me)
                                        default: continue; // nothing to see here
                                }
 
+                               outstr = strcat(strtoupper(gametype), " ", outstr);
                                // now set up order for sorting later
                                orderstr = sprintf("%2.2s%d", gametype, order);
                        }
                        else if(event == "matches")
                        {
-                               outstr = sprintf(_("%s_Matches:"), strtoupper(gametype));
+                               outstr = _("Matches:");
+                               outstr = strcat(strtoupper(gametype), " ", outstr);
                                data = sprintf(_("%d (unranked)"), stof(data));
 
                                // unranked game modes ALWAYS get put last
@@ -251,7 +251,7 @@ void XonoticStatsList_getStats(entity me)
                        else { continue; }
                }
 
-               bufstr_add(me.listStats, sprintf("%s%s %s", orderstr, outstr, data), true);
+               bufstr_add(me.listStats, sprintf("%s%s\n%s", orderstr, outstr, data), true);
        }
 
        me.nItems = buf_getsize(me.listStats);
@@ -294,14 +294,13 @@ void XonoticStatsList_drawListBoxItem(entity me, int i, vector absSize, bool isS
        }
 
        string data = bufstr_get(me.listStats, i);
-       string s = car(data);
-       string d = cdr(data);
+       int ofs = strstrofs(data, "\n", 0);
 
-       s = substring(s, 3, strlen(s) - 3);
-       s = strreplace("_", " ", s);
+       string s = substring(data, 3, ofs - 3);
        s = draw_TextShortenToWidth(s, 0.5 * me.columnNameSize, 0, me.realFontSize);
        draw_Text(me.realUpperMargin * eY + me.columnNameOrigin * eX, s, me.realFontSize, '1 1 1', SKINALPHA_TEXT, 1);
 
+       string d = substring(data, ofs + 1, strlen(data) - (ofs + 1));
        d = draw_TextShortenToWidth(d, me.columnNameSize - draw_TextWidth(s, 0, me.realFontSize), 0, me.realFontSize);
        draw_Text(me.realUpperMargin * eY + (me.columnNameOrigin + 1 * (me.columnNameSize - draw_TextWidth(d, 0, me.realFontSize))) * eX, d, me.realFontSize, '1 1 1', SKINALPHA_TEXT, 1);
 }