]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
scr: update the centreprint buffer for the empty message
authorbones_was_here <bones_was_here@xonotic.au>
Thu, 1 Aug 2024 12:17:14 +0000 (22:17 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Thu, 1 Aug 2024 17:57:04 +0000 (03:57 +1000)
Fixes a bug introduced by me in
https://github.com/DarkPlacesEngine/darkplaces/pull/159 where a
`svc_finale` message with the empty string could cause a
previously displayed engine centreprint to appear again.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
cl_screen.c

index 6c7e03187f0e0ae214d364e570053845f24982f9..7604fda6429beef3d7645e6b3266d601cb50670f 100644 (file)
@@ -143,19 +143,20 @@ for a few moments
 */
 void SCR_CenterPrint(const char *str)
 {
-       if (str[0] == '\0') // happens when stepping out of a centreprint trigger on alk1.2 start.bsp
-               return;
-
-       // Print the message to the console, but only if it's different to the previous message
-       if (strcmp(str, scr_centerstring))
-               Con_CenterPrint(str);
-       dp_strlcpy(scr_centerstring, str, sizeof(scr_centerstring));
-
        scr_centertime_off = scr_centertime.value;
        scr_centertime_start = cl.time;
 
-// count the number of lines for centering
+       // Print the message to the console and update the scr buffer
+       // but only if it's different to the previous message
+       if (strcmp(str, scr_centerstring) == 0)
+               return;
+       dp_strlcpy(scr_centerstring, str, sizeof(scr_centerstring));
        scr_center_lines = 1;
+       if (str[0] == '\0') // happens when stepping out of a centreprint trigger on alk1.2 start.bsp
+               return;
+       Con_CenterPrint(str);
+
+// count the number of lines for centering
        while (*str)
        {
                if (*str == '\n')