- fixed potential infinite loop in Hexen-style stair builder.

This commit is contained in:
Christoph Oelckers 2022-01-07 00:09:59 +01:00
commit 63fa01205f
4 changed files with 32 additions and 11 deletions

View file

@ -40,6 +40,7 @@
#include "r_data/r_interpolate.h"
#include "g_levellocals.h"
#include "vm.h"
#include "r_utility.h"
//==========================================================================
//
@ -661,6 +662,7 @@ bool FLevelLocals::EV_BuildStairs (int tag, DFloor::EStair type, line_t *line, d
// 1. Find 2-sided line with same sector side[0] (lowest numbered)
// 2. Other side is the next sector to raise
// 3. Unless already moving, or different texture, then stop building
validcount++;
do
{
ok = 0;
@ -668,12 +670,13 @@ bool FLevelLocals::EV_BuildStairs (int tag, DFloor::EStair type, line_t *line, d
if (usespecials & DFloor::stairUseSpecials)
{
// [RH] Find the next sector by scanning for Stairs_Special?
tsec = sec->NextSpecialSector (
tsec = P_NextSpecialSectorVC(sec,
sec->special == Stairs_Special1 ?
Stairs_Special2 : Stairs_Special1, prev);
Stairs_Special2 : Stairs_Special1);
if ( (ok = (tsec != NULL)) )
if ( (ok = (tsec != nullptr)) )
{
tsec->validcount = validcount;
height += stairstep;
// if sector's floor already moving, look for another