mirror of
https://git.code.sf.net/p/quake/newtree
synced 2025-02-12 14:45:27 +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);
|
Con_Printf ("Invalid QSG Protocol number: %s\n", p);
|
||||||
}
|
}
|
||||||
if ((p = Info_ValueForKey (cl.serverinfo, "skybox")) && *p) {
|
if ((p = Info_ValueForKey (cl.serverinfo, "skybox")) && *p) {
|
||||||
if (stricmp (p, "none") == 0) {
|
if (strcaseequal (p, "none")) {
|
||||||
allowskybox = false;
|
allowskybox = false;
|
||||||
} else {
|
} else {
|
||||||
allowskybox = true;
|
allowskybox = true;
|
||||||
|
@ -707,7 +707,7 @@ CL_FullInfo_f (void)
|
||||||
if (*s)
|
if (*s)
|
||||||
s++;
|
s++;
|
||||||
|
|
||||||
if (!stricmp (key, pmodel_name) || !stricmp (key, emodel_name))
|
if (strcaseequal (key, pmodel_name) || strcaseequal (key, emodel_name))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Info_SetValueForKey (cls.userinfo, key, value, MAX_INFO_STRING);
|
Info_SetValueForKey (cls.userinfo, key, value, MAX_INFO_STRING);
|
||||||
|
@ -730,8 +730,9 @@ CL_SetInfo_f (void)
|
||||||
Con_Printf ("usage: setinfo [ <key> <value> ]\n");
|
Con_Printf ("usage: setinfo [ <key> <value> ]\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!stricmp (Cmd_Argv (1), pmodel_name)
|
if (strcaseequal (Cmd_Argv (1), pmodel_name)
|
||||||
|| !strcmp (Cmd_Argv (1), emodel_name)) return;
|
|| strcaseequal (Cmd_Argv (1), emodel_name))
|
||||||
|
return;
|
||||||
|
|
||||||
Info_SetValueForKey (cls.userinfo, Cmd_Argv (1), Cmd_Argv (2),
|
Info_SetValueForKey (cls.userinfo, Cmd_Argv (1), Cmd_Argv (2),
|
||||||
MAX_INFO_STRING);
|
MAX_INFO_STRING);
|
||||||
|
|
|
@ -629,7 +629,7 @@ CL_ParseServerData (void)
|
||||||
// game directory
|
// game directory
|
||||||
str = MSG_ReadString ();
|
str = MSG_ReadString ();
|
||||||
|
|
||||||
if (stricmp (gamedirfile, str)) {
|
if (strcasecmp (gamedirfile, str)) {
|
||||||
// save current config
|
// save current config
|
||||||
Host_WriteConfiguration ();
|
Host_WriteConfiguration ();
|
||||||
cflag = true;
|
cflag = true;
|
||||||
|
|
|
@ -254,7 +254,7 @@ Draw_TextureMode_f (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < 6; i++) {
|
for (i = 0; i < 6; i++) {
|
||||||
if (!stricmp (modes[i].name, Cmd_Argv (1)))
|
if (strcaseequal (modes[i].name, Cmd_Argv (1)))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (i == 6) {
|
if (i == 6) {
|
||||||
|
|
|
@ -65,7 +65,7 @@ R_LoadSkys (char *skyname)
|
||||||
QFile *f;
|
QFile *f;
|
||||||
char name[64];
|
char name[64];
|
||||||
|
|
||||||
if (stricmp (skyname, "none") == 0) {
|
if (strcaseequal (skyname, "none")) {
|
||||||
skyloaded = false;
|
skyloaded = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -258,8 +258,8 @@ Info_SetValueForStarKey (char *s, char *key, char *value, size_t maxsize)
|
||||||
// only copy ascii values
|
// only copy ascii values
|
||||||
s += strlen (s);
|
s += strlen (s);
|
||||||
v = newstr;
|
v = newstr;
|
||||||
is_name = stricmp (key, "name") == 0;
|
is_name = strcaseequal (key, "name");
|
||||||
is_team = stricmp (key, "team") == 0;
|
is_team = strcaseequal (key, "team");
|
||||||
while (*v) {
|
while (*v) {
|
||||||
c = (unsigned char) *v++;
|
c = (unsigned char) *v++;
|
||||||
// client only allows highbits on name
|
// client only allows highbits on name
|
||||||
|
|
|
@ -328,7 +328,7 @@ SV_Map_f (void)
|
||||||
if (!f) {
|
if (!f) {
|
||||||
Con_Printf ("Can't find %s\n", expanded);
|
Con_Printf ("Can't find %s\n", expanded);
|
||||||
// If curlevel == level, something is SCREWED! --KB
|
// If curlevel == level, something is SCREWED! --KB
|
||||||
if (stricmp (level, curlevel) == 0)
|
if (strcaseequal (level, curlevel))
|
||||||
SV_Error ("map: cannot restart level\n");
|
SV_Error ("map: cannot restart level\n");
|
||||||
else
|
else
|
||||||
Cbuf_AddText (va ("map %s", curlevel));
|
Cbuf_AddText (va ("map %s", curlevel));
|
||||||
|
|
|
@ -704,7 +704,7 @@ SVC_DirectConnect (void)
|
||||||
s = Info_ValueForKey (userinfo, "spectator");
|
s = Info_ValueForKey (userinfo, "spectator");
|
||||||
if (s[0] && strcmp (s, "0")) {
|
if (s[0] && strcmp (s, "0")) {
|
||||||
if (spectator_password->string[0] &&
|
if (spectator_password->string[0] &&
|
||||||
stricmp (spectator_password->string, "none") &&
|
strcasecmp (spectator_password->string, "none") &&
|
||||||
strcmp (spectator_password->string, s)) { // failed
|
strcmp (spectator_password->string, s)) { // failed
|
||||||
Con_Printf ("%s:spectator password failed\n",
|
Con_Printf ("%s:spectator password failed\n",
|
||||||
NET_AdrToString (net_from));
|
NET_AdrToString (net_from));
|
||||||
|
@ -719,7 +719,7 @@ SVC_DirectConnect (void)
|
||||||
} else {
|
} else {
|
||||||
s = Info_ValueForKey (userinfo, "password");
|
s = Info_ValueForKey (userinfo, "password");
|
||||||
if (password->string[0] &&
|
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));
|
Con_Printf ("%s:password failed\n", NET_AdrToString (net_from));
|
||||||
Netchan_OutOfBandPrint (net_from,
|
Netchan_OutOfBandPrint (net_from,
|
||||||
"%c\nserver requires a password\n\n",
|
"%c\nserver requires a password\n\n",
|
||||||
|
@ -1737,7 +1737,7 @@ SV_ExtractFromUserinfo (client_t *cl)
|
||||||
val = Info_ValueForKey (cl->userinfo, "name");
|
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);
|
Info_SetValueForKey (cl->userinfo, "name", "unnamed", MAX_INFO_STRING);
|
||||||
val = Info_ValueForKey (cl->userinfo, "name");
|
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++) {
|
for (i = 0, client = svs.clients; i < MAX_CLIENTS; i++, client++) {
|
||||||
if (client->state != cs_spawned || client == cl)
|
if (client->state != cs_spawned || client == cl)
|
||||||
continue;
|
continue;
|
||||||
if (!stricmp (client->name, val))
|
if (strcaseequal (client->name, val))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (i != MAX_CLIENTS) { // dup name
|
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
|
// If skyname is set, we want to allow skyboxes and set what
|
||||||
// the skybox name should be. "qlsky" is supported since
|
// the skybox name should be. "qlsky" is supported since
|
||||||
// at least one other map uses it already. --KB
|
// at least one other map uses it already. --KB
|
||||||
if (stricmp (key, "sky") == 0 || // LordHavoc: added "sky" key
|
if (strcaseequal (key, "sky")
|
||||||
// (Quake2 and DarkPlaces use
|
|| strcaseequal (key, "skyname")
|
||||||
// this)
|
|| strcaseequal (key, "qlsky")) {
|
||||||
stricmp (key, "skyname") == 0 ||
|
|
||||||
stricmp (key, "qlsky") == 0) {
|
|
||||||
Info_SetValueForKey (svs.info, "skybox",
|
Info_SetValueForKey (svs.info, "skybox",
|
||||||
"1", MAX_SERVERINFO_STRING);
|
"1", MAX_SERVERINFO_STRING);
|
||||||
Cvar_Set (r_skyname, value);
|
Cvar_Set (r_skyname, value);
|
||||||
|
|
|
@ -346,64 +346,68 @@ Team_Init_Cvars (void)
|
||||||
void
|
void
|
||||||
locs_loc (void)
|
locs_loc (void)
|
||||||
{
|
{
|
||||||
char *mapname;
|
char *mapname;
|
||||||
char *desc = NULL;
|
char *desc = NULL;
|
||||||
char locfile[MAX_OSPATH];
|
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) {
|
if (Cmd_Argc () == 1) {
|
||||||
Con_Printf ("loc <add|delete|rename|move|save|zsave> [<description>] :Modifies location data, add|rename take <description> parameter\n");
|
Con_Printf ("loc <add|delete|rename|move|save|zsave> [<description>] :Modifies location data, add|rename take <description> parameter\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Cmd_Argc () >= 3)
|
if (Cmd_Argc () >= 3)
|
||||||
desc = Cmd_Args () + strlen(Cmd_Argv(1)) + 1;
|
desc = Cmd_Args () + strlen (Cmd_Argv (1)) + 1;
|
||||||
mapname = malloc(sizeof(cl.worldmodel->name));
|
|
||||||
if (!mapname)
|
if (!(mapname = malloc (sizeof (cl.worldmodel->name))))
|
||||||
Sys_Error ("Can't duplicate mapname!");
|
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);
|
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) {
|
if (Cmd_Argc () == 2) {
|
||||||
locs_save(locfile, false);
|
locs_save (locfile, false);
|
||||||
} else
|
} else {
|
||||||
Con_Printf("loc save :saves locs from memory into a .loc file\n");
|
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) {
|
if (Cmd_Argc () == 2) {
|
||||||
locs_save(locfile, true);
|
locs_save (locfile, true);
|
||||||
} else
|
} else {
|
||||||
Con_Printf("loc save :saves locs from memory into a .loc file\n");
|
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)
|
if (Cmd_Argc () >= 3)
|
||||||
locs_mark(cl.simorg,desc);
|
locs_mark (cl.simorg, desc);
|
||||||
else
|
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)
|
if (Cmd_Argc () >= 3)
|
||||||
locs_edit(cl.simorg,desc);
|
locs_edit (cl.simorg, desc);
|
||||||
else
|
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)
|
if (Cmd_Argc () == 2)
|
||||||
locs_del(cl.simorg);
|
locs_del (cl.simorg);
|
||||||
else
|
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)
|
if (Cmd_Argc () == 2)
|
||||||
locs_edit(cl.simorg,NULL);
|
locs_edit (cl.simorg, NULL);
|
||||||
else
|
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