- fixed: DoSetMapSection could cause a stack overflow on large maps. Made it iterative instead of recursive to avoid that.

This commit is contained in:
Christoph Oelckers 2016-07-27 16:27:40 +02:00
parent c9f93d9c88
commit da1762ac2c

View file

@ -69,11 +69,16 @@ void InitGLRMapinfoData();
//
//
//==========================================================================
static TArray<subsector_t *> MapSectionCollector;
static void DoSetMapSection(subsector_t *sub, int num)
{
MapSectionCollector.Resize(1);
MapSectionCollector[0] = sub;
sub->mapsection = num;
for (unsigned a = 0; a < MapSectionCollector.Size(); a++)
{
sub = MapSectionCollector[a];
for (DWORD i = 0; i < sub->numlines; i++)
{
seg_t * seg = sub->firstline + i;
@ -85,11 +90,14 @@ static void DoSetMapSection(subsector_t *sub, int num)
if (sub2->mapsection != num)
{
assert(sub2->mapsection == 0);
DoSetMapSection(sub2, num);
sub2->mapsection = num;
MapSectionCollector.Push(sub2);
}
}
}
}
MapSectionCollector.Clear();
}
//==========================================================================
//