Remove redundant saving of GL nodes if they were loaded from cache

This commit is contained in:
alexey.lysiuk 2014-06-02 11:37:40 +03:00 committed by Christoph Oelckers
parent 3e7b0c2916
commit 20adcecb1d
1 changed files with 16 additions and 12 deletions

View File

@ -959,6 +959,7 @@ bool P_LoadGLNodes(MapData * map)
bool P_CheckNodes(MapData * map, bool rebuilt, int buildtime)
{
bool ret = false;
bool loaded = false;
// If the map loading code has performed a node rebuild we don't need to check for it again.
if (!rebuilt && !P_CheckForGLNodes())
@ -978,7 +979,8 @@ bool P_CheckNodes(MapData * map, bool rebuilt, int buildtime)
numsegs = 0;
// Try to load GL nodes (cached or GWA)
if (!P_LoadGLNodes(map))
loaded = P_LoadGLNodes(map);
if (!loaded)
{
// none found - we have to build new ones!
unsigned int startTime, endTime;
@ -1006,20 +1008,22 @@ bool P_CheckNodes(MapData * map, bool rebuilt, int buildtime)
}
}
if (!loaded)
{
#ifdef DEBUG
// Building nodes in debug is much slower so let's cache them only if cachetime is 0
buildtime = 0;
// Building nodes in debug is much slower so let's cache them only if cachetime is 0
buildtime = 0;
#endif
if (gl_cachenodes && buildtime/1000.f >= gl_cachetime)
{
DPrintf("Caching nodes\n");
CreateCachedNodes(map);
if (gl_cachenodes && buildtime/1000.f >= gl_cachetime)
{
DPrintf("Caching nodes\n");
CreateCachedNodes(map);
}
else
{
DPrintf("Not caching nodes (time = %f)\n", buildtime/1000.f);
}
}
else
{
DPrintf("Not caching nodes (time = %f)\n", buildtime/1000.f);
}
if (!gamenodes)
{