- fixed a few dangling pointers on traveling between levels

https://forum.zdoom.org/viewtopic.php?t=69747
This commit is contained in:
alexey.lysiuk 2020-09-02 15:33:30 +03:00
parent 0ab2ddca4c
commit c46dcd03a3
2 changed files with 9 additions and 1 deletions

View file

@ -1428,7 +1428,6 @@ void FLevelLocals::StartTravel ()
if (Players[i]->health > 0)
{
pawn->UnlinkFromWorld (nullptr);
pawn->BlockingLine = nullptr;
int tid = pawn->tid; // Save TID
pawn->SetTID(0);
pawn->tid = tid; // Restore TID (but no longer linked into the hash chain)

View file

@ -279,6 +279,15 @@ void FLevelLocals::ClearPortals()
void FLevelLocals::ClearLevelData()
{
{
auto it = GetThinkerIterator<AActor>(NAME_None, STAT_TRAVELLING);
for (AActor *actor = it.Next(); actor != nullptr; actor = it.Next())
{
actor->BlockingLine = nullptr;
actor->BlockingFloor = actor->BlockingCeiling = actor->Blocking3DFloor = nullptr;
}
}
interpolator.ClearInterpolations(); // [RH] Nothing to interpolate on a fresh level.
Thinkers.DestroyAllThinkers();
ClearAllSubsectorLinks(); // can't be done as part of the polyobj deletion process.