1
0
Fork 0
forked from fte/fteqw

Fix multiplayer menu breaking pak file names.

This commit is contained in:
Shpoike 2023-01-19 00:20:35 +00:00
parent 89ef66642e
commit 07032bc216

View file

@ -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))