- fixed: updatesectorneighborz may not return -1.

This value gets never validated by any caller and isn't really what is wanted in this situation.
This commit is contained in:
Christoph Oelckers 2021-12-08 19:19:10 +01:00
parent 74da3e5fa7
commit 8e2d324e85

View file

@ -476,9 +476,10 @@ int32_t spriteheightofsptr(uspriteptr_t spr, int32_t *height, int32_t alsotileyo
// 1: floor or down
int32_t nextsectorneighborz(int16_t sectnum, int32_t refz, int16_t topbottom, int16_t direction)
{
int32_t nextz = (direction==1) ? INT32_MAX : INT32_MIN;
int32_t sectortouse = -1;
int32_t nextz = (direction == 1) ? INT32_MAX : INT32_MIN;
int32_t sectortouse = sectnum; // was -1, which is bad because no caller checks it.
assert(validSectorIndex(sectnum));
auto wal = (uwallptr_t)sector[sectnum].firstWall();
int32_t i = sector[sectnum].wallnum;