diff --git a/Runtime/CRelayTracker.cpp b/Runtime/CRelayTracker.cpp index a232fc5d2..20f358742 100644 --- a/Runtime/CRelayTracker.cpp +++ b/Runtime/CRelayTracker.cpp @@ -8,17 +8,19 @@ namespace urde { -CRelayTracker::CRelayTracker(CBitStreamReader& in, const CSaveWorld& saveworld) { - u32 relayCount = saveworld.GetRelayCount(); - if (saveworld.GetRelayCount()) { - std::vector relayStates(saveworld.GetRelayCount()); - for (u32 i = 0; i < relayCount; ++i) +CRelayTracker::CRelayTracker(CBitStreamReader& in, const CSaveWorld& saveWorld) { + const u32 relayCount = saveWorld.GetRelayCount(); + if (saveWorld.GetRelayCount()) { + std::vector relayStates(saveWorld.GetRelayCount()); + for (u32 i = 0; i < relayCount; ++i) { relayStates[i] = in.ReadEncoded(1); + } for (u32 i = 0; i < relayCount; ++i) { - if (!relayStates[i]) + if (!relayStates[i]) { continue; - x0_relayStates.push_back(saveworld.GetRelayEditorId(i)); + } + x0_relayStates.push_back(saveWorld.GetRelayEditorId(i)); } } } @@ -77,18 +79,20 @@ void CRelayTracker::SendMsgs(TAreaId areaId, CStateManager& stateMgr) { } } -void CRelayTracker::PutTo(CBitStreamWriter& out, const CSaveWorld& saveworld) { - u32 relayCount = saveworld.GetRelayCount(); +void CRelayTracker::PutTo(CBitStreamWriter& out, const CSaveWorld& saveWorld) { + const u32 relayCount = saveWorld.GetRelayCount(); std::vector relays(relayCount); for (const TEditorId& id : x0_relayStates) { - s32 idx = saveworld.GetRelayIndex(id); - if (idx >= 0) + const s32 idx = saveWorld.GetRelayIndex(id); + if (idx >= 0) { relays[idx] = true; + } } - for (u32 i = 0; i < relayCount; ++i) + for (u32 i = 0; i < relayCount; ++i) { out.WriteEncoded(u32(relays[i]), 1); + } } } // namespace urde diff --git a/Runtime/CRelayTracker.hpp b/Runtime/CRelayTracker.hpp index 51a9493ea..fdeb8bb0e 100644 --- a/Runtime/CRelayTracker.hpp +++ b/Runtime/CRelayTracker.hpp @@ -29,13 +29,13 @@ class CRelayTracker { public: CRelayTracker() = default; - CRelayTracker(CBitStreamReader&, const CSaveWorld&); + CRelayTracker(CBitStreamReader& in, const CSaveWorld& saveWorld); - bool HasRelay(TEditorId) const; - void AddRelay(TEditorId); - void RemoveRelay(TEditorId); - void SendMsgs(TAreaId, CStateManager&); - void PutTo(CBitStreamWriter&, const CSaveWorld&); + bool HasRelay(TEditorId id) const; + void AddRelay(TEditorId id); + void RemoveRelay(TEditorId id); + void SendMsgs(TAreaId areaId, CStateManager& stateMgr); + void PutTo(CBitStreamWriter& out, const CSaveWorld& saveWorld); }; } // namespace urde