Merge branch 'master' of ssh://gitlab.axiodl.com:6431/AxioDL/urde

This commit is contained in:
Jack Andersen 2017-12-03 17:22:05 -10:00
commit ee5ca06830
3 changed files with 21 additions and 13 deletions

View File

@ -434,16 +434,16 @@ void CStateManager::SetActorAreaId(CActor& actor, TAreaId aid)
{
CGameArea* area = x850_world->GetArea(actorAid);
if (area->IsPostConstructed())
area->GetAreaObjects().RemoveObject(actor.GetUniqueId());
area->GetAreaObjects()->RemoveObject(actor.GetUniqueId());
}
if (aid == kInvalidAreaId)
return;
CGameArea* area = x850_world->GetArea(aid);
if (!area->IsPostConstructed() || area->GetAreaObjects().GetValidObjectById(actor.GetUniqueId()))
if (!area->IsPostConstructed() || area->GetAreaObjects()->GetValidObjectById(actor.GetUniqueId()))
return;
area->GetAreaObjects().AddObject(actor);
area->GetAreaObjects()->AddObject(actor);
}
void CStateManager::TouchSky() const
@ -2300,7 +2300,7 @@ void CStateManager::RemoveObject(TUniqueId uid)
{
CGameArea* area = x850_world->GetArea(ent->GetAreaIdAlways());
if (area->IsPostConstructed())
area->GetAreaObjects().RemoveObject(uid);
area->GetAreaObjects()->RemoveObject(uid);
}
if (TCastToPtr<CActor> act = ent)
x874_sortedListManager->Remove(act.GetPtr());
@ -2470,7 +2470,7 @@ void CStateManager::AddObject(CEntity& ent)
{
CGameArea* area = x850_world->GetArea(ent.GetAreaIdAlways());
if (area->IsPostConstructed())
area->GetAreaObjects().AddObject(ent);
area->GetAreaObjects()->AddObject(ent);
}
if (TCastToPtr<CActor> act = ent)

View File

@ -360,15 +360,20 @@ public:
s32 GetDockCount() const { return xcc_docks.size(); }
Dock* DockNC(s32 dock) { return &xcc_docks[dock]; }
bool IsPostConstructed() const {return xf0_24_postConstructed;}
const CPostConstructed* GetPostConstructed() const {return x12c_postConstructed.get();}
bool IsPostConstructed() const { return xf0_24_postConstructed && x12c_postConstructed; }
const CPostConstructed* GetPostConstructed() const
{
if (!x12c_postConstructed)
return nullptr;
return x12c_postConstructed.get();
}
bool IsValidated() const { return xf0_28_validated; }
void SetAreaAttributes(const CScriptAreaAttributes* areaAttributes);
bool GetActive() const { return xf0_25_active; }
void SetActive(bool active) { xf0_25_active = active; }
CObjectList& GetAreaObjects() const { return *GetPostConstructed()->x10c0_areaObjs.get(); }
CObjectList* GetAreaObjects() const { return GetPostConstructed()->x10c0_areaObjs.get(); }
CGameArea* GetNext() const { return x130_next; }

View File

@ -72,8 +72,10 @@ 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)
{
for (CEntity* ent : *objs)
{
TCastToPtr<CScriptDock> dock(ent);
if (dock && dock->GetDockId() == otherDock)
@ -81,6 +83,7 @@ void CScriptDock::Think(float dt, CStateManager& mgr)
}
}
}
}
x264_dockState = EDockState::Idle;
}