]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Reorder string building
authorDes <xon@damianv.com.ar>
Sun, 1 Dec 2024 15:54:11 +0000 (12:54 -0300)
committerDes <xon@damianv.com.ar>
Sun, 1 Dec 2024 15:54:11 +0000 (12:54 -0300)
qcsrc/client/hud/panel/racetimer.qc

index 9a36920ec336e8ba6a02d5391584cf693d204f15..d4b3ebe562c8392b407f8a3a0a66432bea7e856a 100644 (file)
@@ -219,7 +219,14 @@ void HUD_RaceTimer ()
                                }
                                else
                                {
-                                       string speed_text = string_null;
+                                       string racetime_text = string_null;
+
+                                       // build checkpoint split strings
+                                       if(race_time && race_previousbesttime)
+                                               s = MakeRaceString(race_checkpoint, TIME_DECODE(race_time) - TIME_DECODE(race_previousbesttime), 0, ((race_mypreviousbesttime) ? TIME_DECODE(race_time) - TIME_DECODE(race_mypreviousbesttime) : 0), 0, race_previousbestname);
+                                       else
+                                               s = MakeRaceString(race_checkpoint, 0, -1, 0, 0, race_previousbestname);
+
                                        if(autocvar_cl_race_cptimes_showspeed)
                                        {
                                                float speed_conversion_factor = GetSpeedUnitFactor(autocvar_hud_speed_unit);
@@ -233,9 +240,9 @@ void HUD_RaceTimer ()
                                                else if (speed_diff == 0) speed_color = "^3";
 
                                                if(race_time && race_previousbesttime && race_checkpoint_splits_speed[race_checkpoint])
-                                                       speed_text = sprintf(" ^7%d%s %s(%+d%s)", speed * speed_conversion_factor, units_text, speed_color, speed_diff * speed_conversion_factor, units_text);
+                                                       racetime_text = sprintf("%s ^7%d%s %s(%+d%s)", s, speed * speed_conversion_factor, units_text, speed_color, speed_diff * speed_conversion_factor, units_text);
                                                else
-                                                       speed_text = sprintf(" ^7%d%s", speed * speed_conversion_factor, units_text);
+                                                       racetime_text = sprintf("%s ^7%d%s", s, speed * speed_conversion_factor, units_text);
 
                                                // if fastest cp time, store speed for later comparison
                                                if((TIME_DECODE(race_time) - TIME_DECODE(race_previousbesttime)) < 0 || !race_checkpoint_splits_speed[race_checkpoint])
@@ -244,15 +251,10 @@ void HUD_RaceTimer ()
                                                }
 
                                        }
-                                       // build checkpoint split strings
-                                       if(race_time && race_previousbesttime)
-                                               s = strcat(MakeRaceString(race_checkpoint, TIME_DECODE(race_time) - TIME_DECODE(race_previousbesttime), 0, ((race_mypreviousbesttime) ? TIME_DECODE(race_time) - TIME_DECODE(race_mypreviousbesttime) : 0), 0, race_previousbestname), speed_text);
-                                       else
-                                               s = strcat(MakeRaceString(race_checkpoint, 0, -1, 0, 0, race_previousbestname), speed_text);
                                        if(race_time)
                                                forcetime = TIME_ENCODED_TOSTRING(race_time, false);
 
-                                       StoreRaceSplits(race_checkpoint, forcetime, s);
+                                       StoreRaceSplits(race_checkpoint, forcetime, racetime_text);
                                }
                        }
                        else