mirror of
https://git.code.sf.net/p/quake/newtree
synced 2025-02-08 07:12:00 +00:00
Eliminate the use of stricmp()
This commit is contained in:
parent
3cde1a0608
commit
df184072f1
9 changed files with 51 additions and 48 deletions
|
@ -609,7 +609,7 @@ CL_FullServerinfo_f (void)
|
|||
Con_Printf ("Invalid QSG Protocol number: %s\n", p);
|
||||
}
|
||||
if ((p = Info_ValueForKey (cl.serverinfo, "skybox")) && *p) {
|
||||
if (stricmp (p, "none") == 0) {
|
||||
if (strcaseequal (p, "none")) {
|
||||
allowskybox = false;
|
||||
} else {
|
||||
allowskybox = true;
|
||||
|
@ -707,7 +707,7 @@ CL_FullInfo_f (void)
|
|||
if (*s)
|
||||
s++;
|
||||
|
||||
if (!stricmp (key, pmodel_name) || !stricmp (key, emodel_name))
|
||||
if (strcaseequal (key, pmodel_name) || strcaseequal (key, emodel_name))
|
||||
continue;
|
||||
|
||||
Info_SetValueForKey (cls.userinfo, key, value, MAX_INFO_STRING);
|
||||
|
@ -730,8 +730,9 @@ CL_SetInfo_f (void)
|
|||
Con_Printf ("usage: setinfo [ <key> <value> ]\n");
|
||||
return;
|
||||
}
|
||||
if (!stricmp (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);
|
||||
|
|
|
@ -629,7 +629,7 @@ CL_ParseServerData (void)
|
|||
// game directory
|
||||
str = MSG_ReadString ();
|
||||
|
||||
if (stricmp (gamedirfile, str)) {
|
||||
if (strcasecmp (gamedirfile, str)) {
|
||||
// save current config
|
||||
Host_WriteConfiguration ();
|
||||
cflag = true;
|
||||
|
|
|
@ -254,7 +254,7 @@ Draw_TextureMode_f (void)
|
|||
}
|
||||
|
||||
for (i = 0; i < 6; i++) {
|
||||
if (!stricmp (modes[i].name, Cmd_Argv (1)))
|
||||
if (strcaseequal (modes[i].name, Cmd_Argv (1)))
|
||||
break;
|
||||
}
|
||||
if (i == 6) {
|
||||
|
|
|
@ -65,7 +65,7 @@ R_LoadSkys (char *skyname)
|
|||
QFile *f;
|
||||
char name[64];
|
||||
|
||||
if (stricmp (skyname, "none") == 0) {
|
||||
if (strcaseequal (skyname, "none")) {
|
||||
skyloaded = false;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -258,8 +258,8 @@ Info_SetValueForStarKey (char *s, char *key, char *value, size_t maxsize)
|
|||
// only copy ascii values
|
||||
s += strlen (s);
|
||||
v = newstr;
|
||||
is_name = stricmp (key, "name") == 0;
|
||||
is_team = stricmp (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
|
||||
|
|
|
@ -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 (stricmp (level, curlevel) == 0)
|
||||
if (strcaseequal (level, curlevel))
|
||||
SV_Error ("map: cannot restart level\n");
|
||||
else
|
||||
Cbuf_AddText (va ("map %s", curlevel));
|
||||
|
|
|
@ -704,7 +704,7 @@ SVC_DirectConnect (void)
|
|||
s = Info_ValueForKey (userinfo, "spectator");
|
||||
if (s[0] && strcmp (s, "0")) {
|
||||
if (spectator_password->string[0] &&
|
||||
stricmp (spectator_password->string, "none") &&
|
||||
strcasecmp (spectator_password->string, "none") &&
|
||||
strcmp (spectator_password->string, s)) { // failed
|
||||
Con_Printf ("%s:spectator password failed\n",
|
||||
NET_AdrToString (net_from));
|
||||
|
@ -719,7 +719,7 @@ SVC_DirectConnect (void)
|
|||
} else {
|
||||
s = Info_ValueForKey (userinfo, "password");
|
||||
if (password->string[0] &&
|
||||
stricmp (password->string, "none") && strcmp (password->string, s)) {
|
||||
strcasecmp (password->string, "none") && strcmp (password->string, s)) {
|
||||
Con_Printf ("%s:password failed\n", NET_AdrToString (net_from));
|
||||
Netchan_OutOfBandPrint (net_from,
|
||||
"%c\nserver requires a password\n\n",
|
||||
|
@ -1737,7 +1737,7 @@ SV_ExtractFromUserinfo (client_t *cl)
|
|||
val = Info_ValueForKey (cl->userinfo, "name");
|
||||
}
|
||||
|
||||
if (!val[0] || !stricmp (val, "console")) {
|
||||
if (!val[0] || strcaseequal (val, "console")) {
|
||||
Info_SetValueForKey (cl->userinfo, "name", "unnamed", MAX_INFO_STRING);
|
||||
val = Info_ValueForKey (cl->userinfo, "name");
|
||||
}
|
||||
|
@ -1746,7 +1746,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 (!stricmp (client->name, val))
|
||||
if (strcaseequal (client->name, val))
|
||||
break;
|
||||
}
|
||||
if (i != MAX_CLIENTS) { // dup name
|
||||
|
|
|
@ -120,11 +120,9 @@ 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 (stricmp (key, "sky") == 0 || // LordHavoc: added "sky" key
|
||||
// (Quake2 and DarkPlaces use
|
||||
// this)
|
||||
stricmp (key, "skyname") == 0 ||
|
||||
stricmp (key, "qlsky") == 0) {
|
||||
if (strcaseequal (key, "sky")
|
||||
|| strcaseequal (key, "skyname")
|
||||
|| strcaseequal (key, "qlsky")) {
|
||||
Info_SetValueForKey (svs.info, "skybox",
|
||||
"1", MAX_SERVERINFO_STRING);
|
||||
Cvar_Set (r_skyname, value);
|
||||
|
|
|
@ -346,64 +346,68 @@ Team_Init_Cvars (void)
|
|||
void
|
||||
locs_loc (void)
|
||||
{
|
||||
char *mapname;
|
||||
char *desc = NULL;
|
||||
char locfile[MAX_OSPATH];
|
||||
char *mapname;
|
||||
char *desc = NULL;
|
||||
char locfile[MAX_OSPATH];
|
||||
|
||||
//FIXME checking needed to make sure you are actually in the game and a live.
|
||||
// FIXME checking needed to make sure you are actually in the game and a live.
|
||||
if (Cmd_Argc () == 1) {
|
||||
Con_Printf ("loc <add|delete|rename|move|save|zsave> [<description>] :Modifies location data, add|rename take <description> parameter\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (Cmd_Argc () >= 3)
|
||||
desc = Cmd_Args () + strlen(Cmd_Argv(1)) + 1;
|
||||
mapname = malloc(sizeof(cl.worldmodel->name));
|
||||
if (!mapname)
|
||||
desc = Cmd_Args () + strlen (Cmd_Argv (1)) + 1;
|
||||
|
||||
if (!(mapname = malloc (sizeof (cl.worldmodel->name))))
|
||||
Sys_Error ("Can't duplicate mapname!");
|
||||
map_to_loc(cl.worldmodel->name,mapname);
|
||||
|
||||
map_to_loc (cl.worldmodel->name, mapname);
|
||||
snprintf (locfile, sizeof (locfile), "%s/%s", com_gamedir, mapname);
|
||||
free(mapname);
|
||||
free (mapname);
|
||||
|
||||
if (stricmp(Cmd_Argv(1),"save") == 0) {
|
||||
if (strcaseequal (Cmd_Argv (1), "save")) {
|
||||
if (Cmd_Argc () == 2) {
|
||||
locs_save(locfile, false);
|
||||
} else
|
||||
Con_Printf("loc save :saves locs from memory into a .loc file\n");
|
||||
locs_save (locfile, false);
|
||||
} else {
|
||||
Con_Printf ("loc save :saves locs from memory into a .loc file\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (stricmp(Cmd_Argv(1),"zsave") == 0) {
|
||||
if (strcaseequal (Cmd_Argv (1), "zsave")) {
|
||||
if (Cmd_Argc () == 2) {
|
||||
locs_save(locfile, true);
|
||||
} else
|
||||
Con_Printf("loc save :saves locs from memory into a .loc file\n");
|
||||
locs_save (locfile, true);
|
||||
} else {
|
||||
Con_Printf ("loc save :saves locs from memory into a .loc file\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (stricmp(Cmd_Argv(1),"add") == 0) {
|
||||
if (strcaseequal (Cmd_Argv (1), "add")) {
|
||||
if (Cmd_Argc () >= 3)
|
||||
locs_mark(cl.simorg,desc);
|
||||
locs_mark (cl.simorg, desc);
|
||||
else
|
||||
Con_Printf("loc add <description> :marks the current location with the description and records the information into a loc file.\n");
|
||||
Con_Printf ("loc add <description> :marks the current location with the description and records the information into a loc file.\n");
|
||||
}
|
||||
|
||||
if (stricmp(Cmd_Argv(1),"rename") == 0) {
|
||||
if (strcaseequal (Cmd_Argv (1), "rename")) {
|
||||
if (Cmd_Argc () >= 3)
|
||||
locs_edit(cl.simorg,desc);
|
||||
locs_edit (cl.simorg, desc);
|
||||
else
|
||||
Con_Printf("loc rename <description> :changes the description of the nearest location marker\n");
|
||||
Con_Printf ("loc rename <description> :changes the description of the nearest location marker\n");
|
||||
}
|
||||
|
||||
if (stricmp(Cmd_Argv(1),"delete") == 0) {
|
||||
if (strcaseequal (Cmd_Argv (1), "delete")) {
|
||||
if (Cmd_Argc () == 2)
|
||||
locs_del(cl.simorg);
|
||||
locs_del (cl.simorg);
|
||||
else
|
||||
Con_Printf("loc delete :removes nearest location marker\n");
|
||||
Con_Printf ("loc delete :removes nearest location marker\n");
|
||||
}
|
||||
|
||||
if (stricmp(Cmd_Argv(1),"move") == 0) {
|
||||
if (strcaseequal (Cmd_Argv (1), "move")) {
|
||||
if (Cmd_Argc () == 2)
|
||||
locs_edit(cl.simorg,NULL);
|
||||
locs_edit (cl.simorg, NULL);
|
||||
else
|
||||
Con_Printf("loc move :moves the nearest location marker to your current location\n");
|
||||
Con_Printf ("loc move :moves the nearest location marker to your current location\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue