2016-05-18 03:57:43 +00:00
|
|
|
#include "CScriptMemoryRelay.hpp"
|
2016-07-25 06:24:57 +00:00
|
|
|
#include "CStateManager.hpp"
|
|
|
|
#include "CRelayTracker.hpp"
|
2017-01-15 03:07:01 +00:00
|
|
|
#include "TCastTo.hpp"
|
2016-05-18 03:57:43 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
namespace urde {
|
2016-05-18 03:57:43 +00:00
|
|
|
|
2017-11-13 06:19:18 +00:00
|
|
|
CScriptMemoryRelay::CScriptMemoryRelay(TUniqueId uid, std::string_view name, const CEntityInfo& info, bool b1,
|
2017-08-29 13:17:52 +00:00
|
|
|
bool skipSendActive, bool ignoreMessages)
|
2018-12-08 05:30:43 +00:00
|
|
|
: CEntity(uid, info, true, name)
|
|
|
|
, x34_24_(b1)
|
|
|
|
, x34_25_skipSendActive(skipSendActive)
|
|
|
|
, x34_26_ignoreMessages(ignoreMessages) {}
|
2016-05-18 03:57:43 +00:00
|
|
|
|
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;
|
2016-07-25 06:24:57 +00:00
|
|
|
|
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);
|
2016-05-18 03:57:43 +00:00
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
|
|
|
|
} // namespace urde
|