Revert "- fixed: updatesectorneighborz may not return -1."

This reverts commit c074b0995648a4057c516e5646f5fe7a11719317.

* The commit notes talk about `updatesectorneighborz()`, but the change is applied to `nextsectorneighborz()`. Further to this, `nextsectorneighborz()` is only called from some ptr wrappers in `build.h` and they both test against `-1` return values.

```
inline sectortype* nextsectorneighborzptr(int16_t sectnum, int32_t refz, int16_t topbottom, int16_t direction)
{
	auto sect = nextsectorneighborz(sectnum, refz, topbottom, direction);
	return sect == -1? nullptr : &sector[sect];
}

inline sectortype* nextsectorneighborzptr(sectortype* sectp, int32_t refz, int16_t topbottom, int16_t direction)
{
	auto sect = nextsectorneighborz(sector.IndexOf(sectp), refz, topbottom, direction);
	return sect == -1? nullptr : &sector[sect];
}
```

* Also fixes broken Duke elevators and possibly a whole raft of issues.
This commit is contained in:
Mitchell Richters 2021-12-11 13:38:18 +11:00 committed by Christoph Oelckers
parent 953c7e4ed6
commit 1ee1c0c920

View file

@ -476,10 +476,9 @@ 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 = sectnum; // was -1, which is bad because no caller checks it.
int32_t nextz = (direction==1) ? INT32_MAX : INT32_MIN;
int32_t sectortouse = -1;
assert(validSectorIndex(sectnum));
auto wal = (uwallptr_t)sector[sectnum].firstWall();
int32_t i = sector[sectnum].wallnum;