- Miscellaneous fixes to commit to change sector checks over to validSectorIndex().

* Fix missed changeover in Blood's `actSpawnSprite()`.
* Fix non-negated check on a `validSectorIndex()` call in Blood's `debrisMove()`.
* Removed a superfluous terminator in Duke's `actor.cpp`.
* Fixed bad call to `validSectorIndex()` in Exhumed's `AIAnim::Tick()`.
This commit is contained in:
Mitch Richters 2021-11-10 08:45:25 +11:00 committed by Christoph Oelckers
parent 999ec3c95a
commit c6f2aaf1b7
4 changed files with 4 additions and 10 deletions

View file

@ -6402,7 +6402,7 @@ DBloodActor* actSpawnSprite(DBloodActor* source, int nStat)
BloodStatIterator it(kStatPurge);
actor = it.Next();
assert(actor);
assert(pSource->sectnum >= 0 && pSource->sectnum < kMaxSectors);
assert(validSectorIndex(pSource->sectnum));
ChangeActorSect(actor, pSource->sectnum);
actPostSprite(actor, nStat);
}

View file

@ -1692,17 +1692,11 @@ void debrisMove(int listIndex)
spritetype* pSprite = &actor->s();
int nSector = pSprite->sectnum;
if (!actor->hasX())
if (!actor->hasX() || !validSectorIndex(pSprite->sectnum))
{
gPhysSpritesList[listIndex] = nullptr;
return;
}
else if (validSectorIndex(pSprite->sectnum))
{
gPhysSpritesList[listIndex] = nullptr;
return;
}
int top, bottom, i;
GetActorExtents(actor, &top, &bottom);

View file

@ -2255,7 +2255,7 @@ bool jibs(DDukeActor *actor, int JIBS6, bool timeout, bool callsetsprite, bool f
if (callsetsprite) setsprite(actor, s->pos);
// this was after the slope calls, but we should avoid calling that for invalid sectors.
if (!validSectorIndex(s->sectnum));
if (!validSectorIndex(s->sectnum))
{
deletesprite(actor);
return false;

View file

@ -149,7 +149,7 @@ void AIAnim::Tick(RunListEvent* ev)
if (pSpriteB->sectnum != pSprite->sectnum)
{
if (!validSectorIndex(pSpriteB))
if (!validSectorIndex(pSpriteB->sectnum))
{
DestroyAnim(pActor);
return;