Clear references to map data on level change
These shouldn't be left as they'll now point towards potentially invalid memory and also cause errors with serializing. Arrays and maps holding them are cleared. Also unlinks and relinks inventory items correctly from the hashmap on traveling.
This commit is contained in:
parent
29b2253bdb
commit
269689703d
6 changed files with 87 additions and 3 deletions
|
|
@ -1646,6 +1646,9 @@ void FLevelLocals::StartTravel ()
|
|||
inv->UnlinkFromWorld (nullptr);
|
||||
inv->UnlinkBehaviorsFromLevel();
|
||||
inv->DeleteAttachedLights();
|
||||
tid = inv->tid;
|
||||
inv->SetTID(0);
|
||||
inv->tid = tid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1751,7 +1754,7 @@ int FLevelLocals::FinishTravel ()
|
|||
pawn->LinkBehaviorsToLevel();
|
||||
pawn->ClearInterpolation();
|
||||
pawn->ClearFOVInterpolation();
|
||||
const int tid = pawn->tid; // Save TID (actor isn't linked into the hash chain yet)
|
||||
int tid = pawn->tid; // Save TID (actor isn't linked into the hash chain yet)
|
||||
pawn->tid = 0; // Reset TID
|
||||
pawn->SetTID(tid); // Set TID (and link actor into the hash chain)
|
||||
pawn->SetState(pawn->SpawnState);
|
||||
|
|
@ -1763,6 +1766,9 @@ int FLevelLocals::FinishTravel ()
|
|||
inv->LinkToWorld (nullptr);
|
||||
P_FindFloorCeiling(inv, FFCF_ONLYSPAWNPOS);
|
||||
inv->LinkBehaviorsToLevel();
|
||||
tid = inv->tid;
|
||||
inv->tid = 0;
|
||||
inv->SetTID(tid);
|
||||
|
||||
IFVIRTUALPTRNAME(inv, NAME_Inventory, Travelled)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue