From: bones_was_here Date: Thu, 1 Aug 2024 12:17:14 +0000 (+1000) Subject: scr: update the centreprint buffer for the empty message X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=6f9cc79f5ebfcb46d62bf08835fb6330aa6862df;p=xonotic%2Fdarkplaces.git scr: update the centreprint buffer for the empty message 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 --- diff --git a/cl_screen.c b/cl_screen.c index 6c7e0318..7604fda6 100644 --- a/cl_screen.c +++ b/cl_screen.c @@ -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')