aboutsummaryrefslogtreecommitdiffstats
path: root/code
diff options
context:
space:
mode:
Diffstat (limited to 'code')
-rw-r--r--code/game/g_client.c2
-rw-r--r--code/qcommon/q_shared.h4
2 files changed, 3 insertions, 3 deletions
diff --git a/code/game/g_client.c b/code/game/g_client.c
index 0d812ed..2e968af 100644
--- a/code/game/g_client.c
+++ b/code/game/g_client.c
@@ -632,7 +632,7 @@ static void ClientCleanName(const char *in, char *out, int outSize)
{
colorlessLen--;
- if(*in == COLOR_BLACK)
+ if(ColorIndex(*in) == 0)
{
// Disallow color black in names to prevent players
// from getting advantage playing in front of black backgrounds
diff --git a/code/qcommon/q_shared.h b/code/qcommon/q_shared.h
index 736d9e9..0680733 100644
--- a/code/qcommon/q_shared.h
+++ b/code/qcommon/q_shared.h
@@ -365,7 +365,7 @@ extern vec4_t colorMdGrey;
extern vec4_t colorDkGrey;
#define Q_COLOR_ESCAPE '^'
-#define Q_IsColorString(p) ((p) && *(p) == Q_COLOR_ESCAPE && *((p)+1) && *((p)+1) >= '0' && *((p)+1) <= '7') // ^[0-9a-zA-Z]
+#define Q_IsColorString(p) ((p) && *(p) == Q_COLOR_ESCAPE && *((p)+1) && isalnum(*((p)+1))) // ^[0-9a-zA-Z]
#define COLOR_BLACK '0'
#define COLOR_RED '1'
@@ -375,7 +375,7 @@ extern vec4_t colorDkGrey;
#define COLOR_CYAN '5'
#define COLOR_MAGENTA '6'
#define COLOR_WHITE '7'
-#define ColorIndex(c) ((c) - '0')
+#define ColorIndex(c) (((c) - '0') & 0x07)
#define S_COLOR_BLACK "^0"
#define S_COLOR_RED "^1"