Quit the game if SE17 (warp elevator) setup fails.

The spawn-time SE 17 setup uses nextsectorneighborz() which can fail
(return -1) on some circumstances and would cause an OOB sector[] access.

git-svn-id: https://svn.eduke32.com/eduke32@2971 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-08-26 22:17:14 +00:00
parent 2b58c6de4c
commit ffa4e8ebb3

View file

@ -5541,10 +5541,22 @@ int32_t A_Spawn(int32_t j, int32_t pn)
T3 = sector[sect].floorz; //Stopping loc T3 = sector[sect].floorz; //Stopping loc
j = nextsectorneighborz(sect,sector[sect].floorz,-1,-1); j = nextsectorneighborz(sect,sector[sect].floorz,-1,-1);
if (j >= 0)
{
T4 = sector[j].ceilingz; T4 = sector[j].ceilingz;
j = nextsectorneighborz(sect,sector[sect].ceilingz,1,1); j = nextsectorneighborz(sect,sector[sect].ceilingz,1,1);
if (j >= 0)
T5 = sector[j].floorz; T5 = sector[j].floorz;
}
if (j < 0)
{
// XXX: we should return to the menu for this and similar failures
Bsprintf(tempbuf, "SE 17 (warp elevator) setup failed: sprite %d at (%d, %d)",
i, sprite[i].x, sprite[i].y);
G_GameExit(tempbuf);
}
if (numplayers < 2 && !g_netServer) if (numplayers < 2 && !g_netServer)
{ {