2
0
mirror of https://github.com/rehlds/rehlds.git synced 2025-01-05 19:45:33 +03:00

Merge pull request #167 from WPMGPRoSToTeMa/autoprecachemapstxtoverviewsandskys

Additional checks for WAD precaching
This commit is contained in:
theAsmodai 2016-02-07 13:39:08 +03:00
commit 41671cb4ab

View File

@ -5060,22 +5060,30 @@ void PrecacheMapSpecifiedResources()
if (FS_FileExists(va("maps/%s_detail.txt", g_psv.name))) if (FS_FileExists(va("maps/%s_detail.txt", g_psv.name)))
PF_precache_generic_I(va("maps/%s_detail.txt", g_psv.name)); PF_precache_generic_I(va("maps/%s_detail.txt", g_psv.name));
char tempPath[1024]; if (wadpath != nullptr)
Q_strncpy(tempPath, wadpath, sizeof(tempPath) - 2);
tempPath[sizeof(tempPath) - 2] = 0;
if (!Q_strchr(tempPath, ';'))
Q_strcat(tempPath, ";");
for (char *token = strtok(tempPath, ";"); token != nullptr; token = strtok(nullptr, ";"))
{ {
char wadName[MAX_QPATH]; char tempPath[1024];
COM_FileBase(token, wadName); Q_strncpy(tempPath, wadpath, sizeof(tempPath) - 2);
tempPath[sizeof(tempPath) - 2] = 0;
if (!Q_strchr(tempPath, ';'))
Q_strcat(tempPath, ";");
if (Q_strstr(wadName, "pldecal") || Q_strstr(wadName, "tempdecal")) for (char *token = strtok(tempPath, ";"); token != nullptr; token = strtok(nullptr, ";"))
continue; {
char wadName[MAX_QPATH];
COM_FileBase(token, wadName);
COM_DefaultExtension(wadName, ".wad");
COM_DefaultExtension(wadName, ".wad"); if (!FS_FileExists(wadName)
PF_precache_generic_I(wadName); || !Q_stricmp(wadName, "pldecal.wad")
|| !Q_stricmp(wadName, "tempdecal.wad")
|| !Q_stricmp(wadName, "halflife.wad")
|| !Q_stricmp(wadName, "xeno.wad")
|| !Q_stricmp(wadName, "decals.wad"))
continue;
PF_precache_generic_I(wadName);
}
} }
} }
#endif // REHLDS_FIXES #endif // REHLDS_FIXES