metaforce/Runtime/World/CScriptDockAreaChange.cpp

36 lines
1.3 KiB
C++
Raw Normal View History

#include "Runtime/World/CScriptDockAreaChange.hpp"
#include "Runtime/CStateManager.hpp"
#include "Runtime/World/CScriptDock.hpp"
#include "TCastTo.hpp" // Generated file, do not modify include path
2016-12-22 02:48:22 +00:00
2018-12-08 05:30:43 +00:00
namespace urde {
2017-11-13 06:19:18 +00:00
CScriptDockAreaChange::CScriptDockAreaChange(TUniqueId uid, std::string_view name, const CEntityInfo& info, s32 w1,
2016-12-22 02:48:22 +00:00
bool active)
2018-12-08 05:30:43 +00:00
: CEntity(uid, info, active, name), x34_dockReference(w1) {}
2017-01-15 03:07:01 +00:00
2018-12-08 05:30:43 +00:00
void CScriptDockAreaChange::Accept(IVisitor& visitor) { visitor.Visit(this); }
2016-12-22 02:48:22 +00:00
2018-12-08 05:30:43 +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;
2016-12-22 02:48:22 +00:00
2018-12-08 05:30:43 +00:00
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);
}
2016-12-22 02:48:22 +00:00
}
2018-12-08 05:30:43 +00:00
SendScriptMsgs(EScriptObjectState::Play, stateMgr, EScriptObjectMessage::None);
}
CEntity::AcceptScriptMsg(msg, objId, stateMgr);
2016-12-22 02:48:22 +00:00
}
2018-12-08 05:30:43 +00:00
} // namespace urde