metaforce/Runtime/World/CScriptMemoryRelay.cpp

46 lines
1.2 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"
namespace urde
{
CScriptMemoryRelay::CScriptMemoryRelay(TUniqueId uid, const std::string& name, const CEntityInfo& info, bool b1,
bool skipSendActive, bool ignoreMessages)
: CEntity(uid, info, true, name),
x34_24_(b1),
x34_25_skipSendActive(skipSendActive),
x34_26_ignoreMessages(ignoreMessages)
{
}
2017-01-15 03:07:01 +00:00
void CScriptMemoryRelay::Accept(IVisitor& visitor)
{
visitor.Visit(this);
}
void CScriptMemoryRelay::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager &stateMgr)
{
if (x34_26_ignoreMessages)
return;
if (msg == EScriptObjectMessage::Deactivate)
{
stateMgr.GetRelayTracker()->RemoveRelay(xc_editorId);
return;
}
else if (msg == EScriptObjectMessage::Activate)
{
stateMgr.GetRelayTracker()->AddRelay(xc_editorId);
2017-01-30 06:08:44 +00:00
if (!x34_25_skipSendActive)
2016-07-25 17:58:47 +00:00
SendScriptMsgs(EScriptObjectState::Active, stateMgr, EScriptObjectMessage::None);
return;
}
CEntity::AcceptScriptMsg(msg, objId, stateMgr);
}
}