mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-02-16 17:11:03 +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",
|
"tag",
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
char *buffer;
|
char *buffer;
|
||||||
char mapsname[1024];
|
|
||||||
char *s;
|
char *s;
|
||||||
int length;
|
int length;
|
||||||
int i;
|
int i;
|
||||||
FILE *fp;
|
|
||||||
float scale = SCR_GetMenuScale();
|
float scale = SCR_GetMenuScale();
|
||||||
|
|
||||||
/* initialize list of maps once, reuse it afterwards (=> it isn't freed) */
|
/* initialize list of maps once, reuse it afterwards (=> it isn't freed) */
|
||||||
if (mapnames == NULL)
|
if (mapnames == NULL)
|
||||||
{
|
{
|
||||||
/* load the list of map names */
|
/* load the list of map names */
|
||||||
Com_sprintf(mapsname, sizeof(mapsname), "%s/maps.lst", FS_Gamedir());
|
if ((length = FS_LoadFile("maps.lst", (void **)&buffer)) == -1)
|
||||||
|
|
||||||
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");
|
||||||
{
|
|
||||||
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;
|
s = buffer;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|
||||||
while (i < length)
|
while (i < length)
|
||||||
|
@ -2896,17 +2881,7 @@ StartServer_MenuInit(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
mapnames[nummaps] = 0;
|
mapnames[nummaps] = 0;
|
||||||
|
FS_FreeFile(buffer);
|
||||||
if (fp != 0)
|
|
||||||
{
|
|
||||||
fclose(fp);
|
|
||||||
fp = 0;
|
|
||||||
free(buffer);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
FS_FreeFile(buffer);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* initialize the menu stuff */
|
/* initialize the menu stuff */
|
||||||
|
|
|
@ -335,6 +335,7 @@ Developer_searchpath(int who)
|
||||||
{
|
{
|
||||||
fsSearchPath_t *search;
|
fsSearchPath_t *search;
|
||||||
|
|
||||||
|
// TODO: Distinguish baseq from mods.
|
||||||
for (search = fs_searchPaths; search; search = search->next)
|
for (search = fs_searchPaths; search; search = search->next)
|
||||||
{
|
{
|
||||||
if (strstr(search->path, "xatrix"))
|
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. */
|
/* Search inside a pack file. */
|
||||||
if (search->pack)
|
if (search->pack)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue