mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-01-18 22:51:39 +00:00
- fixed: DoSetMapSection could cause a stack overflow on large maps. Made it iterative instead of recursive to avoid that.
This commit is contained in:
parent
c9f93d9c88
commit
da1762ac2c
1 changed files with 17 additions and 9 deletions
|
@ -69,26 +69,34 @@ void InitGLRMapinfoData();
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
static TArray<subsector_t *> MapSectionCollector;
|
||||||
|
|
||||||
static void DoSetMapSection(subsector_t *sub, int num)
|
static void DoSetMapSection(subsector_t *sub, int num)
|
||||||
{
|
{
|
||||||
|
MapSectionCollector.Resize(1);
|
||||||
|
MapSectionCollector[0] = sub;
|
||||||
sub->mapsection = num;
|
sub->mapsection = num;
|
||||||
|
for (unsigned a = 0; a < MapSectionCollector.Size(); a++)
|
||||||
for(DWORD i=0;i<sub->numlines;i++)
|
|
||||||
{
|
{
|
||||||
seg_t * seg = sub->firstline + i;
|
sub = MapSectionCollector[a];
|
||||||
|
for (DWORD i = 0; i < sub->numlines; i++)
|
||||||
if (seg->PartnerSeg)
|
|
||||||
{
|
{
|
||||||
subsector_t * sub2 = seg->PartnerSeg->Subsector;
|
seg_t * seg = sub->firstline + i;
|
||||||
|
|
||||||
if (sub2->mapsection != num)
|
if (seg->PartnerSeg)
|
||||||
{
|
{
|
||||||
assert(sub2->mapsection == 0);
|
subsector_t * sub2 = seg->PartnerSeg->Subsector;
|
||||||
DoSetMapSection(sub2, num);
|
|
||||||
|
if (sub2->mapsection != num)
|
||||||
|
{
|
||||||
|
assert(sub2->mapsection == 0);
|
||||||
|
sub2->mapsection = num;
|
||||||
|
MapSectionCollector.Push(sub2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
MapSectionCollector.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
Loading…
Reference in a new issue