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

View file

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