Fix multiplayer menu breaking pak file names.
This commit is contained in:
parent
89ef66642e
commit
07032bc216
1 changed files with 8 additions and 3 deletions
|
@ -637,14 +637,19 @@ static int QDECL M_Menu_GameOptions_AddMap(const char *fname, qofs_t fsize, time
|
||||||
struct mapopts_s *ctx = parm;
|
struct mapopts_s *ctx = parm;
|
||||||
size_t i;
|
size_t i;
|
||||||
char *ext;
|
char *ext;
|
||||||
|
char trimmedfname[MAX_QPATH];
|
||||||
if (Q_strncasecmp(fname, "maps/", 5))
|
if (Q_strncasecmp(fname, "maps/", 5))
|
||||||
return true; //o.O
|
return true; //o.O
|
||||||
fname += 5;
|
fname += 5;
|
||||||
if (*fname == 'b' && *fname == '_')
|
if (fname[0] == 'b' && fname[1] == '_')
|
||||||
return true; //stoopid ammo boxes.
|
return true; //stoopid ammo boxes.
|
||||||
ext = strrchr(fname, '.');
|
ext = strrchr(fname, '.');
|
||||||
if (ext && !strcmp(ext, ".bsp"))
|
if (ext && !strcmp(ext, ".bsp") && ext-fname<sizeof(trimmedfname))
|
||||||
*ext = 0;
|
{
|
||||||
|
memcpy(trimmedfname, fname, ext-fname);
|
||||||
|
trimmedfname[ext-fname] = 0;
|
||||||
|
fname = trimmedfname;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < ctx->count; i++)
|
for (i = 0; i < ctx->count; i++)
|
||||||
if (!Q_strcasecmp(ctx->maps[i], fname))
|
if (!Q_strcasecmp(ctx->maps[i], fname))
|
||||||
|
|
Loading…
Reference in a new issue