fix a couple of editor issues:

- one reported by Micky:
http://forums.duke4.net/topic/3911-true-room-over-room/page__view__findpost__p__106610
- malloc(0) call when saving a map with no sprites
- update 'asksave' after Alt-S and corrupt-check on starting a new map

git-svn-id: https://svn.eduke32.com/eduke32@2017 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2011-09-12 15:03:51 +00:00
parent c698822a41
commit 3b634f28ae
2 changed files with 41 additions and 32 deletions

View file

@ -5300,6 +5300,10 @@ end_join_sectors:
{
NEXTWALL(i).nextwall = i;
NEXTWALL(i).nextsector = numsectors;
#ifdef YAX_ENABLE
yax_setnextwall(i, YAX_CEILING, -1);
yax_setnextwall(i, YAX_FLOOR, -1);
#endif
}
#ifdef YAX_ENABLE
yax_setbunches(numsectors, -1, -1);
@ -5310,6 +5314,7 @@ end_join_sectors:
newnumwalls = -1;
numsectors++;
asksave = 1;
printmessage16("Inner loop made into new sector.");
}
}
@ -6555,6 +6560,8 @@ CANCEL:
message("Can't copy highlighted portion of old map: limits exceeded.");
}
CheckMapCorruption(4, 0);
break;
}

View file

@ -9743,40 +9743,42 @@ int32_t saveboard(const char *filename, int32_t *daposx, int32_t *daposy, int32_
ts = B_LITTLE16(numsprites); Bwrite(fil,&ts,2);
tspri = (spritetype *)Bmalloc(sizeof(spritetype) * numsprites);
if (tspri == NULL)
break;
spri=tspri;
for (j=0; j<MAXSPRITES; j++)
if (numsprites > 0)
{
if (sprite[j].statnum != MAXSTATUS)
{
Bmemcpy(spri,&sprite[j],sizeof(spritetype));
spri->x = B_LITTLE32(spri->x);
spri->y = B_LITTLE32(spri->y);
spri->z = B_LITTLE32(spri->z);
spri->cstat = B_LITTLE16(spri->cstat);
spri->picnum = B_LITTLE16(spri->picnum);
spri->sectnum = B_LITTLE16(spri->sectnum);
spri->statnum = B_LITTLE16(spri->statnum);
spri->ang = B_LITTLE16(spri->ang);
spri->owner = B_LITTLE16(spri->owner);
spri->xvel = B_LITTLE16(spri->xvel);
spri->yvel = B_LITTLE16(spri->yvel);
spri->zvel = B_LITTLE16(spri->zvel);
spri->lotag = B_LITTLE16(spri->lotag);
spri->hitag = B_LITTLE16(spri->hitag);
spri->extra = B_LITTLE16(spri->extra);
spri++;
}
}
tspri = (spritetype *)Bmalloc(sizeof(spritetype) * numsprites);
Bwrite(fil,&tspri[0],sizeof(spritetype) * numsprites);
Bfree(tspri);
if (tspri == NULL)
break;
spri=tspri;
for (j=0; j<MAXSPRITES; j++)
{
if (sprite[j].statnum != MAXSTATUS)
{
Bmemcpy(spri,&sprite[j],sizeof(spritetype));
spri->x = B_LITTLE32(spri->x);
spri->y = B_LITTLE32(spri->y);
spri->z = B_LITTLE32(spri->z);
spri->cstat = B_LITTLE16(spri->cstat);
spri->picnum = B_LITTLE16(spri->picnum);
spri->sectnum = B_LITTLE16(spri->sectnum);
spri->statnum = B_LITTLE16(spri->statnum);
spri->ang = B_LITTLE16(spri->ang);
spri->owner = B_LITTLE16(spri->owner);
spri->xvel = B_LITTLE16(spri->xvel);
spri->yvel = B_LITTLE16(spri->yvel);
spri->zvel = B_LITTLE16(spri->zvel);
spri->lotag = B_LITTLE16(spri->lotag);
spri->hitag = B_LITTLE16(spri->hitag);
spri->extra = B_LITTLE16(spri->extra);
spri++;
}
}
Bwrite(fil,&tspri[0],sizeof(spritetype) * numsprites);
Bfree(tspri);
}
Bclose(fil);
return(0);