X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=common.c;h=9e5d4259f98aec25aeccf994772d887978326722;hb=2caacb44b17d25721eff1f10fcd4438ae5d18947;hp=fe84a1ddf24ea6db4dff0e6d11fde621c9ae5eb5;hpb=0aa07db479084620f1d966b3d5a7e2d8848adb1c;p=xonotic%2Fdarkplaces.git diff --git a/common.c b/common.c index fe84a1dd..9e5d4259 100644 --- a/common.c +++ b/common.c @@ -303,15 +303,15 @@ void MSG_WriteFloat (sizebuf_t *sb, float f) void MSG_WriteString (sizebuf_t *sb, const char *s) { - if (!s) - SZ_Write (sb, (unsigned char *)"", 1); + if (!s || !*s) + MSG_WriteChar (sb, 0); else SZ_Write (sb, (unsigned char *)s, (int)strlen(s)+1); } void MSG_WriteUnterminatedString (sizebuf_t *sb, const char *s) { - if (s) + if (s && *s) SZ_Write (sb, (unsigned char *)s, (int)strlen(s)); } @@ -633,7 +633,13 @@ void Com_HexDumpToConsole(const unsigned char *data, int size) { if (j < n) { - if (d[j] >= ' ' && d[j] <= 127) + // color change prefix character has to be treated specially + if (d[j] == STRING_COLOR_TAG) + { + *cur++ = STRING_COLOR_TAG; + *cur++ = STRING_COLOR_TAG; + } + else if (d[j] >= ' ') *cur++ = d[j]; else *cur++ = '.';