safety check when copying sectors; a suggestion to bypass a strange bug

git-svn-id: https://svn.eduke32.com/eduke32@1449 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2009-07-03 13:01:52 +00:00
parent f2aa52ac07
commit 28e5528417
2 changed files with 60 additions and 40 deletions

View file

@ -3960,6 +3960,12 @@ SKIP:
if (keystatus[0xd2] || keystatus[0x17]) //InsertPoint if (keystatus[0xd2] || keystatus[0x17]) //InsertPoint
{ {
if (highlightsectorcnt >= 0) if (highlightsectorcnt >= 0)
{
int32_t newwalls = 0;
for (i=0; i<highlightsectorcnt; i++)
newwalls += sector[highlightsector[i]].wallnum;
if (highlightsectorcnt + numsectors <= MAXSECTORS && numwalls+newwalls <= MAXWALLS)
{ {
newnumsectors = numsectors; newnumsectors = numsectors;
newnumwalls = numwalls; newnumwalls = numwalls;
@ -3992,7 +3998,14 @@ SKIP:
printmessage16("Sectors duplicated and stamped."); printmessage16("Sectors duplicated and stamped.");
asksave = 1; asksave = 1;
} }
else
{
printmessage16("Copying sectors would exceed sector or wall limit.");
}
}
else if (highlightcnt >= 0) else if (highlightcnt >= 0)
{
if (highlightcnt + numsprites <= MAXSPRITES)
{ {
for (i=0; i<highlightcnt; i++) for (i=0; i<highlightcnt; i++)
if ((highlight[i]&0xc000) == 16384) if ((highlight[i]&0xc000) == 16384)
@ -4008,6 +4021,11 @@ SKIP:
printmessage16("Sprites duplicated and stamped."); printmessage16("Sprites duplicated and stamped.");
asksave = 1; asksave = 1;
} }
else
{
printmessage16("Copying sprites would exceed sprite limit.");
}
}
else if (linehighlight >= 0) else if (linehighlight >= 0)
{ {
int32_t wallsdrawn = newnumwalls-numwalls; int32_t wallsdrawn = newnumwalls-numwalls;

View file

@ -441,8 +441,10 @@ int32_t writesetup(const char *fn)
#endif #endif
// "; Console key scancode, in hex\n" // "; Console key scancode, in hex\n"
"keyconsole = %X\n" "keyconsole = %X\n"
"; example: make 'Q' function as CapsLock and 'N' as AltGr:\n" "; example: make 'Q' function as CapsLock, KP. as AltGr\n"
"; remap = 10-3A,31-B8\n" "; and KP0 as KP5 (counters inability to pan using Shift-KP5-KP8/2\n"
"; in 3D mode)\n"
"; remap = 10-3A,52-4C,53-B8\n"
"remap = ", "remap = ",
forcesetup, fullscreen, xdim2d, ydim2d, xdimgame, ydimgame, bppgame, forcesetup, fullscreen, xdim2d, ydim2d, xdimgame, ydimgame, bppgame,