2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-09 05:47:42 +00:00

Fix game crashing when touching a dock to an unloaded area

This commit is contained in:
2017-12-03 18:26:17 -08:00
parent 2bb0a9687e
commit 5c7a03fb40
3 changed files with 21 additions and 13 deletions

View File

@@ -72,12 +72,15 @@ void CScriptDock::Think(float dt, CStateManager& mgr)
mgr.SetCurrentAreaId(aid);
s32 otherDock = dock->GetOtherDockNumber(dock->GetReferenceCount());
CObjectList& objs = mgr.WorldNC()->GetArea(aid)->GetAreaObjects();
for (CEntity* ent : objs)
CObjectList* objs = mgr.WorldNC()->GetArea(aid)->GetAreaObjects();
if (objs)
{
TCastToPtr<CScriptDock> dock(ent);
if (dock && dock->GetDockId() == otherDock)
dock->SetLoadConnected(mgr, true);
for (CEntity* ent : *objs)
{
TCastToPtr<CScriptDock> dock(ent);
if (dock && dock->GetDockId() == otherDock)
dock->SetLoadConnected(mgr, true);
}
}
}
}