cmdparser/server command little optimisations.

This commit is contained in:
David Carlier 2024-11-11 19:43:50 +00:00
parent b64ae0ed6e
commit d73f94d034
No known key found for this signature in database
GPG key ID: 8486F847B4B94EF1
2 changed files with 6 additions and 6 deletions

View file

@ -908,7 +908,7 @@ Cmd_CompleteMapCommand(char *partial)
{ {
char **mapNames; char **mapNames;
int i, j, k, nbMatches, len, nMaps; int i, j, k, nbMatches, len, nMaps;
char *mapName; char *mapName, *lastsep;
char *pmatch[1024]; char *pmatch[1024];
qboolean partialFillContinue = true; qboolean partialFillContinue = true;
@ -920,9 +920,9 @@ Cmd_CompleteMapCommand(char *partial)
for (i = 0; i < nMaps - 1; i++) for (i = 0; i < nMaps - 1; i++)
{ {
if (strrchr(mapNames[i], '/')) if ((lastsep = strrchr(mapNames[i], '/')))
{ {
mapName = strrchr(mapNames[i], '/') + 1; mapName = lastsep + 1;
} }
else else
{ {

View file

@ -317,7 +317,7 @@ void SV_ListMaps_f(void)
char **userMapNames; char **userMapNames;
int nUserMaps = 0; int nUserMaps = 0;
int i; int i;
char* mapName; char* mapName, *lastsep;
Com_Printf("\n"); Com_Printf("\n");
@ -325,9 +325,9 @@ void SV_ListMaps_f(void)
{ {
for (i = 0; i < nUserMaps - 1; i++) for (i = 0; i < nUserMaps - 1; i++)
{ {
if (strrchr(userMapNames[i], '/')) if ((lastsep = strrchr(userMapNames[i], '/')))
{ {
mapName = strrchr(userMapNames[i], '/') + 1; mapName = lastsep + 1;
} }
else else
{ {