From f8376160257d286917c2ff48153557dbe7d764fe Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 18 Oct 2000 17:06:44 +0000 Subject: [PATCH] locs.c: handle dos line endings. COM_FOpenFile /always/ opens files in binary mode in Windows (and *nix is effectively binary only anyway) and the \r characters being left in the location description strings was causing %l to print a blank line. Makes for unhappy users :/ teamplay.c: handle %%. this seams to have been missed. --- source/locs.c | 7 ++++++- source/teamplay.c | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/source/locs.c b/source/locs.c index 183e352..65f7fcf 100644 --- a/source/locs.c +++ b/source/locs.c @@ -112,8 +112,13 @@ void locs_load(char *mapname) loc[2] = strtol(t2, &t1, 0) * (1.0/8); t1++; t2 = strrchr(t1, '\n'); - if (t2) + if (t2) { t2[0] = '\0'; + // handle dos format lines (COM_FOpenFile is binary only) + // and unix is effectively binary only anyway + if (t2 > t1 && t2[-1] == '\r') + t2[-1] = '\0'; + } locs_add(loc, t1); } Qclose(file); diff --git a/source/teamplay.c b/source/teamplay.c index bd317bc..29df22e 100644 --- a/source/teamplay.c +++ b/source/teamplay.c @@ -145,6 +145,11 @@ char *Team_ParseSay (char *s) s += 2; } switch (chr) { + case '%': + t2[0] = '%'; + t2[1] = 0; + t1 = t2; + break; case 's': bracket = 0; t1 = skin->string;