2016-12-22 02:48:22 +00:00
|
|
|
#include "CScriptDockAreaChange.hpp"
|
|
|
|
#include "CStateManager.hpp"
|
|
|
|
#include "World/CScriptDock.hpp"
|
2017-01-15 03:07:01 +00:00
|
|
|
#include "TCastTo.hpp"
|
2016-12-22 02:48:22 +00:00
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-01-15 03:07:01 +00:00
|
|
|
void CScriptDockAreaChange::Accept(IVisitor& visitor)
|
|
|
|
{
|
|
|
|
visitor.Visit(this);
|
|
|
|
}
|
|
|
|
|
2016-12-22 02:48:22 +00:00
|
|
|
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;
|
2017-01-15 03:07:01 +00:00
|
|
|
CScriptDock* dock = TCastToPtr<CScriptDock>(stateMgr.ObjectById(id));
|
2016-12-22 02:48:22 +00:00
|
|
|
if (dock)
|
2017-01-04 04:08:30 +00:00
|
|
|
dock->SetDockReference(stateMgr, x34_dockReference);
|
2016-12-22 02:48:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SendScriptMsgs(EScriptObjectState::Play, stateMgr, EScriptObjectMessage::None);
|
|
|
|
}
|
|
|
|
|
|
|
|
CEntity::AcceptScriptMsg(msg, objId, stateMgr);
|
|
|
|
}
|
|
|
|
}
|