From: terencehill Date: Sat, 9 May 2020 12:51:59 +0000 (+0200) Subject: Fix #2433 "Bold messages appearing twice" X-Git-Tag: xonotic-v0.8.5~1087 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=9a953cf35ff480e516942241e23d1f3c23d39655;p=xonotic%2Fxonotic-data.pk3dir.git Fix #2433 "Bold messages appearing twice" --- diff --git a/qcsrc/client/hud/panel/centerprint.qc b/qcsrc/client/hud/panel/centerprint.qc index 5d47ed85a..446a64ec6 100644 --- a/qcsrc/client/hud/panel/centerprint.qc +++ b/qcsrc/client/hud/panel/centerprint.qc @@ -196,7 +196,7 @@ void HUD_CenterPrint () } bool is_bold; - string centerprint_message; + string centerprint_message = strzone(""); int entries; float height; vector fontsize; @@ -216,7 +216,10 @@ void HUD_CenterPrint () // if the notification starts with ^BOLD make it bold (e.g. frag messages); is_bold = (substring(centerprint_messages[j], 0, 5) == BOLD_OPERATOR); // remove ^BOLD so it doesn't get printed onscreen - centerprint_message = is_bold ? strzone(substring(centerprint_messages[j], 5, -1)) : strzone(centerprint_messages[j]); + if (is_bold) + strcpy(centerprint_message, substring(centerprint_messages[j], 5, -1)); + else + strcpy(centerprint_message, centerprint_messages[j]); // entries = bound(1, floor(CENTERPRINT_MAX_ENTRIES * 4 * panel_size_y/panel_size_x), CENTERPRINT_MAX_ENTRIES); // height = panel_size_y/entries; @@ -340,6 +343,7 @@ void HUD_CenterPrint () if (pos.y < panel_pos.y) // check if the next message can be shown { drawfontscale = hud_scale; + strfree(centerprint_message); return; } } @@ -352,13 +356,13 @@ void HUD_CenterPrint () if(pos.y > panel_pos.y + panel_size.y - fontsize.y) // check if the next message can be shown { drawfontscale = hud_scale; + strfree(centerprint_message); return; } } - - // free up memory - strunzone(centerprint_message); } + strfree(centerprint_message); + drawfontscale = hud_scale; if (all_messages_expired) {