diff --git a/src/client/menu/menu.c b/src/client/menu/menu.c index c67256df..28e39a64 100644 --- a/src/client/menu/menu.c +++ b/src/client/menu/menu.c @@ -2819,38 +2819,23 @@ StartServer_MenuInit(void) "tag", 0 }; + char *buffer; - char mapsname[1024]; char *s; int length; int i; - FILE *fp; float scale = SCR_GetMenuScale(); /* initialize list of maps once, reuse it afterwards (=> it isn't freed) */ if (mapnames == NULL) { /* load the list of map names */ - Com_sprintf(mapsname, sizeof(mapsname), "%s/maps.lst", FS_Gamedir()); - - if ((fp = fopen(mapsname, "rb")) == 0) + if ((length = FS_LoadFile("maps.lst", (void **)&buffer)) == -1) { - if ((length = FS_LoadFile("maps.lst", (void **)&buffer)) == -1) - { - Com_Error(ERR_DROP, "couldn't find maps.lst\n"); - } - } - else - { - fseek(fp, 0, SEEK_END); - length = ftell(fp); - fseek(fp, 0, SEEK_SET); - buffer = malloc(length); - fread(buffer, length, 1, fp); + Com_Error(ERR_DROP, "couldn't find maps.lst\n"); } s = buffer; - i = 0; while (i < length) @@ -2896,17 +2881,7 @@ StartServer_MenuInit(void) } mapnames[nummaps] = 0; - - if (fp != 0) - { - fclose(fp); - fp = 0; - free(buffer); - } - else - { - FS_FreeFile(buffer); - } + FS_FreeFile(buffer); } /* initialize the menu stuff */ diff --git a/src/common/filesystem.c b/src/common/filesystem.c index 687761ce..94673cb4 100644 --- a/src/common/filesystem.c +++ b/src/common/filesystem.c @@ -335,6 +335,7 @@ Developer_searchpath(int who) { fsSearchPath_t *search; + // TODO: Distinguish baseq from mods. for (search = fs_searchPaths; search; search = search->next) { if (strstr(search->path, "xatrix")) @@ -384,6 +385,14 @@ FS_FOpenFile(const char *name, fileHandle_t *f, qboolean gamedir_only) } } + // Evil hack for maps.lst and players/ + // TODO: A flag to ignore paks would be better + if ((Developer_searchpath(0) == 0) && search->pack) { + if ((strcmp(name, "maps.lst") == 0)|| (strncmp(name, "players/", 8) == 0)) { + continue; + } + } + /* Search inside a pack file. */ if (search->pack) {