]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix #2575 "FPS field no longer displayed in scoreboard with sv_showfps set"
authorterencehill <piuntn@gmail.com>
Fri, 9 Apr 2021 14:27:47 +0000 (16:27 +0200)
committerterencehill <piuntn@gmail.com>
Fri, 9 Apr 2021 14:27:47 +0000 (16:27 +0200)
qcsrc/client/hud/panel/scoreboard.qc

index 6f41ae9ee7ea9e37db33be7de448d3a671a9c107..58a1093b9511a35a4e41a82d246f3d878739993f 100644 (file)
@@ -464,9 +464,6 @@ void Cmd_Scoreboard_SetFields(int argc)
                }
 
                str = strtolower(str);
-               if(!STAT(SHOWFPS) && str == "fps")
-                       continue;
-
                strcpy(sbt_field_title[sbt_num_fields], TranslateScoresLabel(str));
                sbt_field_size[sbt_num_fields] = stringwidth(sbt_field_title[sbt_num_fields], false, hud_fontsize);
 
@@ -482,7 +479,6 @@ void Cmd_Scoreboard_SetFields(int argc)
                        case "elo": sbt_field[sbt_num_fields] = SP_ELO; break;
                        case "dmg": case "damage": sbt_field[sbt_num_fields] = SP_DMG; break;
                        case "dmgtaken": case "damagetaken": sbt_field[sbt_num_fields] = SP_DMGTAKEN; break;
-                       case "fps": sbt_field[sbt_num_fields] = SP_FPS; break;
                        default:
                        {
                                FOREACH(Scores, true, {
@@ -497,8 +493,12 @@ LABEL(notfound)
                                        j = SP_FRAGS;
                                else
                                {
-                                       if(!nocomplain)
+                                       // NOTE: can't check STAT(SHOWFPS) here, if checked too early it returns false anyway
+                                       if(!nocomplain && str != "fps") // server can disable the fps field
                                                LOG_INFOF("^1Error:^7 Unknown score field: '%s'", str);
+
+                                       strfree(sbt_field_title[sbt_num_fields]);
+                                       sbt_field_size[sbt_num_fields] = 0;
                                        continue;
                                }
 LABEL(found)