metaforce/Runtime/World/CScriptMemoryRelay.cpp

36 lines
1.1 KiB
C++
Raw Normal View History

#include "CScriptMemoryRelay.hpp"
#include "CStateManager.hpp"
#include "CRelayTracker.hpp"
2017-01-15 03:07:01 +00:00
#include "TCastTo.hpp"
2018-12-08 05:30:43 +00:00
namespace urde {
2019-07-17 02:10:57 +00:00
CScriptMemoryRelay::CScriptMemoryRelay(TUniqueId uid, std::string_view name, const CEntityInfo& info, bool defaultActive,
bool skipSendActive, bool ignoreMessages)
2018-12-08 05:30:43 +00:00
: CEntity(uid, info, true, name)
2019-07-17 02:10:57 +00:00
, x34_24_defaultActive(defaultActive)
2018-12-08 05:30:43 +00:00
, x34_25_skipSendActive(skipSendActive)
, x34_26_ignoreMessages(ignoreMessages) {}
2018-12-08 05:30:43 +00:00
void CScriptMemoryRelay::Accept(IVisitor& visitor) { visitor.Visit(this); }
2017-01-15 03:07:01 +00:00
2018-12-08 05:30:43 +00:00
void CScriptMemoryRelay::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& stateMgr) {
if (x34_26_ignoreMessages)
return;
2018-12-08 05:30:43 +00:00
if (msg == EScriptObjectMessage::Deactivate) {
stateMgr.GetRelayTracker()->RemoveRelay(xc_editorId);
return;
} else if (msg == EScriptObjectMessage::Activate) {
stateMgr.GetRelayTracker()->AddRelay(xc_editorId);
if (!x34_25_skipSendActive)
SendScriptMsgs(EScriptObjectState::Active, stateMgr, EScriptObjectMessage::None);
return;
}
CEntity::AcceptScriptMsg(msg, objId, stateMgr);
}
2018-12-08 05:30:43 +00:00
} // namespace urde