mirror of https://github.com/AxioDL/metaforce.git
44 lines
1.3 KiB
C++
44 lines
1.3 KiB
C++
#include "CScriptDockAreaChange.hpp"
|
|
#include "CStateManager.hpp"
|
|
#include "World/CScriptDock.hpp"
|
|
#include "TCastTo.hpp"
|
|
|
|
namespace urde
|
|
{
|
|
CScriptDockAreaChange::CScriptDockAreaChange(TUniqueId uid, const std::string& name, const CEntityInfo& info, s32 w1,
|
|
bool active)
|
|
: CEntity(uid, info, active, name), x34_dockReference(w1)
|
|
{
|
|
}
|
|
|
|
void CScriptDockAreaChange::Accept(IVisitor& visitor)
|
|
{
|
|
visitor.Visit(this);
|
|
}
|
|
|
|
void CScriptDockAreaChange::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& stateMgr)
|
|
{
|
|
if (msg == EScriptObjectMessage::Action && GetActive())
|
|
{
|
|
for (SConnection conn : x20_conns)
|
|
{
|
|
if (conn.x0_state != EScriptObjectState::Play)
|
|
continue;
|
|
|
|
auto search = stateMgr.GetIdListForScript(conn.x8_objId);
|
|
for (auto it = search.first ; it != search.second ; ++it)
|
|
{
|
|
TUniqueId id = it->second;
|
|
TCastToPtr<CScriptDock> dock(stateMgr.ObjectById(id));
|
|
if (dock)
|
|
dock->SetDockReference(stateMgr, x34_dockReference);
|
|
}
|
|
}
|
|
|
|
SendScriptMsgs(EScriptObjectState::Play, stateMgr, EScriptObjectMessage::None);
|
|
}
|
|
|
|
CEntity::AcceptScriptMsg(msg, objId, stateMgr);
|
|
}
|
|
}
|