- Blood: validate upper/lower sector links before starting a level.

Originally this just performed an OOB memory access, but with Raze's setup it would dereference a null pointer so these must be eliminated.
This commit is contained in:
Christoph Oelckers 2021-12-16 11:52:19 +01:00
parent 6c1632a744
commit d011f3c201
2 changed files with 26 additions and 0 deletions

View file

@ -36,6 +36,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_BLD_NS
void validateLinks();
FixedBitArray<MAXSPRITES> activeXSprites;
// All AI states for assigning an index.
@ -817,6 +820,7 @@ void GameInterface::SerializeGameState(FSerializer& arc)
Polymost::Polymost_prepare_loadboard();
Mus_ResumeSaved();
}
validateLinks();
}

View file

@ -34,6 +34,27 @@ ZONE gStartZone[8];
ZONE gStartZoneTeam2[8];
bool gTeamsSpawnUsed = false;
#endif
void validateLinks()
{
int snum = 0;
for (auto& sect : sectors())
{
if (getUpperLink(snum) && !getUpperLink(snum)->GetOwner())
{
Printf("Unpartnered upper link in sector %d\n", snum);
gUpperLink[snum] = nullptr;
}
if (getLowerLink(snum) && !getLowerLink(snum)->GetOwner())
{
Printf("Unpartnered upper link in sector %d\n", snum);
gLowerLink[snum] = nullptr;
}
snum++;
}
}
void warpInit(void)
{
for (int i = 0; i < kMaxSectors; i++)
@ -166,6 +187,7 @@ void warpInit(void)
}
}
}
validateLinks();
}
int CheckLink(DBloodActor *actor)