From 58a0206783a88bd1bd65c8703f814fdacdc7fb15 Mon Sep 17 00:00:00 2001 From: Latapostrophe Date: Fri, 21 Sep 2018 17:03:09 +0200 Subject: [PATCH] Moved strlen(w_chat) out of the loop. --- src/hu_stuff.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index cab5937c..77b87328 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -1523,6 +1523,7 @@ static void HU_DrawChat(void) INT32 charwidth = 4, charheight = 6; INT32 t = 0, c = 0, y = chaty - (typelines*charheight) - (cv_kartspeedometer.value ? 16 : 0); UINT32 i = 0; + INT32 saylen = strlen(w_chat); // You learn new things everyday! const char *ntalk = "Say: ", *ttalk = "Team: "; const char *talk = ntalk; @@ -1538,7 +1539,7 @@ static void HU_DrawChat(void) } V_DrawFillConsoleMap(chatx, y-1, cv_chatwidth.value, (typelines*charheight), 239 | V_SNAPTOBOTTOM | V_SNAPTOLEFT); - + while (talk[i]) { if (talk[i] < HU_FONTSTART) @@ -1565,7 +1566,7 @@ static void HU_DrawChat(void) if (hu_tick < 4) V_DrawChatCharacter(cursorx, cursory+1, '_' |V_SNAPTOBOTTOM|V_SNAPTOLEFT|t, !cv_allcaps.value, NULL); - if (cursorx == chatx+1 && strlen(w_chat) == i) // a weirdo hack + if (cursorx == chatx+1 && saylen == i) // a weirdo hack { typelines += 1; skippedline = true;