When restoring temporarily backed up map, clear all TROR bunches. This is

suboptimal, but at least 'correct' and won't produce the aforementioned
corruptions anymore.

git-svn-id: https://svn.eduke32.com/eduke32@2135 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2011-11-26 14:12:59 +00:00
parent f4703a596d
commit b461dc5fb9
1 changed files with 13 additions and 0 deletions

View File

@ -1446,6 +1446,7 @@ static int32_t backup_highlighted_map(mapinfofull_t *mapinfo)
if (highlightsectorcnt <= 0)
return -1;
// set up old-->new mappings
j = 0;
k = 0;
for (i=0; i<numsectors; i++)
@ -1484,8 +1485,10 @@ static int32_t backup_highlighted_map(mapinfofull_t *mapinfo)
// allocate temp storage
mapinfo->sector = Bmalloc(highlightsectorcnt * sizeof(sectortype));
if (!mapinfo->sector) return -2;
mapinfo->wall = Bmalloc(tmpnumwalls * sizeof(walltype));
if (!mapinfo->wall) { Bfree(mapinfo->sector); return -2; }
if (tmpnumsprites>0)
{
mapinfo->sprite = Bmalloc(tmpnumsprites * sizeof(spritetype));
@ -1496,6 +1499,11 @@ static int32_t backup_highlighted_map(mapinfofull_t *mapinfo)
return -2;
}
}
else
{
// would never be accessed because mapinfo->numsprites is 0, but cleaner
mapinfo->sprite = NULL;
}
// copy everything over
@ -1596,7 +1604,12 @@ static int32_t restore_highlighted_map(mapinfofull_t *mapinfo)
Bmemset(hlsectorbitmap, 0, sizeof(hlsectorbitmap));
for (i=onumsectors; i<newnumsectors; i++)
{
hlsectorbitmap[i>>3] |= (1<<(i&7));
#ifdef YAX_ENABLE
yax_setbunches(i, -1, -1);
#endif
}
// insert sprites
for (i=0; i<mapinfo->numsprites; i++)