From f482d8a51443e3d65f5e1df11c99d6d604f0eebb Mon Sep 17 00:00:00 2001 From: TimeServ Date: Thu, 6 Apr 2006 08:21:17 +0000 Subject: [PATCH] fix infinite loop with server color parsing git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2165 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/server/sv_sys_unix.c | 10 ++++++---- engine/server/sv_sys_win.c | 4 +++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/engine/server/sv_sys_unix.c b/engine/server/sv_sys_unix.c index ce2cfd5fe..4317f8604 100644 --- a/engine/server/sv_sys_unix.c +++ b/engine/server/sv_sys_unix.c @@ -215,8 +215,8 @@ void ApplyColour(unsigned int chr) if (chr & CON_BLINKTEXT) printf("5;"); // set blink - bg = chr & CON_BGMASK >> CON_BGSHIFT; - fg = chr & CON_FGMASK >> CON_FGSHIFT; + bg = (chr & CON_BGMASK) >> CON_BGSHIFT; + fg = (chr & CON_FGMASK) >> CON_FGSHIFT; // don't handle intensive bit for background // as terminals differ too much in displaying \e[1;7;3?m @@ -254,7 +254,7 @@ void ApplyColour(unsigned int chr) fg &= 0x7; // strip intensive bit } - printf("3%im", fg); // set foreground + printf("3%im", ansiremap[fg]); // set foreground break; } } @@ -371,7 +371,9 @@ void Sys_Printf (char *fmt, ...) ext = ((*str - '0') << CON_BGSHIFT) | (ext&~CON_BGMASK) | CON_NONCLEARBG; continue; } - str--; // else invalid code + Sys_PrintColouredChar('^' | ext); + Sys_PrintColouredChar('&' | ext); + // else invalid code } else if (*str == 'a') { diff --git a/engine/server/sv_sys_win.c b/engine/server/sv_sys_win.c index c62d21a50..a7ad57158 100644 --- a/engine/server/sv_sys_win.c +++ b/engine/server/sv_sys_win.c @@ -581,7 +581,9 @@ void Sys_Printf (char *fmt, ...) ext = ((*str - '0') << CON_BGSHIFT) | (ext&~CON_BGMASK) | CON_NONCLEARBG; continue; } - str--; // else invalid code + Sys_PrintColouredChar('^' | ext); + Sys_PrintColouredChar('&' | ext); + // else invalid code } else if (*str == 'a') {