From e4608744d248b677aca683b8b8d62d8d3bc616eb Mon Sep 17 00:00:00 2001 From: Jeff Teunissen Date: Wed, 21 Feb 2001 22:38:58 +0000 Subject: [PATCH] str*cmp -> str*equal, where appropriate. --- qw/source/cl_main.c | 9 +++++---- qw/source/cl_parse.c | 6 ++---- qw/source/info.c | 4 ++-- qw/source/sv_ccmds.c | 2 +- qw/source/sv_main.c | 15 ++++++++------- qw/source/sv_progs.c | 19 +++++++++---------- 6 files changed, 27 insertions(+), 28 deletions(-) diff --git a/qw/source/cl_main.c b/qw/source/cl_main.c index 89976f69c..8a6766979 100644 --- a/qw/source/cl_main.c +++ b/qw/source/cl_main.c @@ -591,7 +591,7 @@ CL_FullServerinfo_f (void) Con_Printf ("Invalid standards version: %s", p); } if ((p = Info_ValueForKey (cl.serverinfo, "skybox")) && *p) { - if (strcasecmp (p, "none") == 0) { + if (!strcaseequal (p, "none")) { allowskybox = false; } else { allowskybox = true; @@ -689,7 +689,7 @@ CL_FullInfo_f (void) if (*s) s++; - if (!strcasecmp (key, pmodel_name) || !strcasecmp (key, emodel_name)) + if (strcaseequal (key, pmodel_name) || strcaseequal (key, emodel_name)) continue; Info_SetValueForKey (cls.userinfo, key, value, MAX_INFO_STRING); @@ -712,8 +712,9 @@ CL_SetInfo_f (void) Con_Printf ("usage: setinfo [ ]\n"); return; } - if (!strcasecmp (Cmd_Argv (1), pmodel_name) - || !strcmp (Cmd_Argv (1), emodel_name)) return; + if (strcaseequal (Cmd_Argv (1), pmodel_name) + || strcaseequal (Cmd_Argv (1), emodel_name)) + return; Info_SetValueForKey (cls.userinfo, Cmd_Argv (1), Cmd_Argv (2), MAX_INFO_STRING); diff --git a/qw/source/cl_parse.c b/qw/source/cl_parse.c index 7c1e88326..a69b4c00d 100644 --- a/qw/source/cl_parse.c +++ b/qw/source/cl_parse.c @@ -617,9 +617,7 @@ CL_ParseServerData (void) protover = MSG_ReadLong (); if (protover != PROTOCOL_VERSION && !(cls.demoplayback - && (protover == 26 || protover == 27 - || protover == - 28))) + && (protover <= 26 && protover >= 28))) Host_EndGame ("Server returned version %i, not %i\nYou probably need to upgrade.\nCheck http://www.quakeworld.net/", protover, PROTOCOL_VERSION); @@ -629,7 +627,7 @@ CL_ParseServerData (void) // game directory str = MSG_ReadString (); - if (strcasecmp (gamedirfile, str)) { + if (!strequal (gamedirfile, str)) { // save current config Host_WriteConfiguration (); cflag = true; diff --git a/qw/source/info.c b/qw/source/info.c index cb71114d9..3ad37107a 100644 --- a/qw/source/info.c +++ b/qw/source/info.c @@ -223,8 +223,8 @@ Info_SetValueForStarKey (char *s, char *key, char *value, size_t maxsize) // only copy ascii values s += strlen (s); v = newstr; - is_name = strcasecmp (key, "name") == 0; - is_team = strcasecmp (key, "team") == 0; + is_name = strcaseequal (key, "name"); + is_team = strcaseequal (key, "team"); while (*v) { c = (unsigned char) *v++; // client only allows highbits on name diff --git a/qw/source/sv_ccmds.c b/qw/source/sv_ccmds.c index 780b4e517..cf53c69c0 100644 --- a/qw/source/sv_ccmds.c +++ b/qw/source/sv_ccmds.c @@ -328,7 +328,7 @@ SV_Map_f (void) if (!f) { Con_Printf ("Can't find %s\n", expanded); // If curlevel == level, something is SCREWED! --KB - if (strcasecmp (level, curlevel) == 0) + if (strcaseequal (level, curlevel)) SV_Error ("map: cannot restart level\n"); else Cbuf_AddText (va ("map %s", curlevel)); diff --git a/qw/source/sv_main.c b/qw/source/sv_main.c index 55d548349..30908f34d 100644 --- a/qw/source/sv_main.c +++ b/qw/source/sv_main.c @@ -704,9 +704,9 @@ SVC_DirectConnect (void) s = Info_ValueForKey (userinfo, "spectator"); if (s[0] && strcmp (s, "0")) { if (spectator_password->string[0] && - strcasecmp (spectator_password->string, "none") && - strcmp (spectator_password->string, s)) { // failed - Con_Printf ("%s:spectator password failed\n", + !strcaseequal (spectator_password->string, "none") && + !strequal (spectator_password->string, s)) { // failed + Con_Printf ("%s: spectator password failed\n", NET_AdrToString (net_from)); Netchan_OutOfBandPrint (net_from, "%c\nrequires a spectator password\n\n", @@ -718,8 +718,9 @@ SVC_DirectConnect (void) spectator = true; } else { s = Info_ValueForKey (userinfo, "password"); - if (password->string[0] && - strcasecmp (password->string, "none") && strcmp (password->string, s)) { + if (password->string[0] + && !strcaseequal (password->string, "none") + && !strequal (password->string, s)) { Con_Printf ("%s:password failed\n", NET_AdrToString (net_from)); Netchan_OutOfBandPrint (net_from, "%c\nserver requires a password\n\n", @@ -1748,7 +1749,7 @@ SV_ExtractFromUserinfo (client_t *cl) val = Info_ValueForKey (cl->userinfo, "name"); } - if (!val[0] || !strcasecmp (val, "console")) { + if (!val[0] || strcaseequal (val, "console")) { Info_SetValueForKey (cl->userinfo, "name", "unnamed", MAX_INFO_STRING); val = Info_ValueForKey (cl->userinfo, "name"); } @@ -1757,7 +1758,7 @@ SV_ExtractFromUserinfo (client_t *cl) for (i = 0, client = svs.clients; i < MAX_CLIENTS; i++, client++) { if (client->state != cs_spawned || client == cl) continue; - if (!strcasecmp (client->name, val)) + if (strcaseequal (client->name, val)) break; } if (i != MAX_CLIENTS) { // dup name diff --git a/qw/source/sv_progs.c b/qw/source/sv_progs.c index 0e21e6676..053b86f56 100644 --- a/qw/source/sv_progs.c +++ b/qw/source/sv_progs.c @@ -117,16 +117,15 @@ PR_Profile_f (void) int ED_Parse_Extra_Fields (progs_t *pr, char *key, char *value) { - // If skyname is set, we want to allow skyboxes and set what - // the skybox name should be. "qlsky" is supported since - // at least one other map uses it already. --KB - if (strcasecmp (key, "sky") == 0 || // LordHavoc: added "sky" key - // (Quake2 and DarkPlaces use - // this) - strcasecmp (key, "skyname") == 0 || - strcasecmp (key, "qlsky") == 0) { - Info_SetValueForKey (svs.info, "skybox", - "1", MAX_SERVERINFO_STRING); + /* + If skyname is set, we want to allow skyboxes and set what the skybox + name should be. "qlsky" is supported since at least one other map + uses it already. + */ + if (strcaseequal (key, "skyname") // QuakeForge + || strcaseequal (key, "sky") // Q2/DarkPlaces + || strcaseequal (key, "qlsky")) { // QuakeLives + Info_SetValueForKey (svs.info, "skybox", "1", MAX_SERVERINFO_STRING); Cvar_Set (r_skyname, value); return 1; }