mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-25 22:10:59 +00:00
Don't let baseq2/pak0.pak/maps.lst shadow baseq2/maps.lst.
While here reimplement the same hack for baseq2/players, lost somewhere on the way. This is just another searchpath f*ckup. For some reasons paks have a higher priority than plain directories. We do not want that for the maps.lst and players/ since id Software decided to put updated versions of them directly into baseq2/... This closes issue #217.
This commit is contained in:
parent
0ba9843ffe
commit
ff7772f11d
2 changed files with 13 additions and 29 deletions
|
@ -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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
s = buffer;
|
||||
|
||||
i = 0;
|
||||
|
||||
while (i < length)
|
||||
|
@ -2896,18 +2881,8 @@ StartServer_MenuInit(void)
|
|||
}
|
||||
|
||||
mapnames[nummaps] = 0;
|
||||
|
||||
if (fp != 0)
|
||||
{
|
||||
fclose(fp);
|
||||
fp = 0;
|
||||
free(buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
FS_FreeFile(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
/* initialize the menu stuff */
|
||||
s_startserver_menu.x = (int)(viddef.width * 0.50f);
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue