CRelayTracker: Add names to function prototypes

Allows IDE introspections at call sites to function nicer.
This commit is contained in:
Lioncash 2020-03-25 15:53:45 -04:00
parent c5c888daa6
commit cda5a48970
2 changed files with 22 additions and 18 deletions

View File

@ -8,17 +8,19 @@
namespace urde { namespace urde {
CRelayTracker::CRelayTracker(CBitStreamReader& in, const CSaveWorld& saveworld) { CRelayTracker::CRelayTracker(CBitStreamReader& in, const CSaveWorld& saveWorld) {
u32 relayCount = saveworld.GetRelayCount(); const u32 relayCount = saveWorld.GetRelayCount();
if (saveworld.GetRelayCount()) { if (saveWorld.GetRelayCount()) {
std::vector<bool> relayStates(saveworld.GetRelayCount()); std::vector<bool> relayStates(saveWorld.GetRelayCount());
for (u32 i = 0; i < relayCount; ++i) for (u32 i = 0; i < relayCount; ++i) {
relayStates[i] = in.ReadEncoded(1); relayStates[i] = in.ReadEncoded(1);
}
for (u32 i = 0; i < relayCount; ++i) { for (u32 i = 0; i < relayCount; ++i) {
if (!relayStates[i]) if (!relayStates[i]) {
continue; 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) { void CRelayTracker::PutTo(CBitStreamWriter& out, const CSaveWorld& saveWorld) {
u32 relayCount = saveworld.GetRelayCount(); const u32 relayCount = saveWorld.GetRelayCount();
std::vector<bool> relays(relayCount); std::vector<bool> relays(relayCount);
for (const TEditorId& id : x0_relayStates) { for (const TEditorId& id : x0_relayStates) {
s32 idx = saveworld.GetRelayIndex(id); const s32 idx = saveWorld.GetRelayIndex(id);
if (idx >= 0) if (idx >= 0) {
relays[idx] = true; relays[idx] = true;
} }
}
for (u32 i = 0; i < relayCount; ++i) for (u32 i = 0; i < relayCount; ++i) {
out.WriteEncoded(u32(relays[i]), 1); out.WriteEncoded(u32(relays[i]), 1);
}
} }
} // namespace urde } // namespace urde

View File

@ -29,13 +29,13 @@ class CRelayTracker {
public: public:
CRelayTracker() = default; CRelayTracker() = default;
CRelayTracker(CBitStreamReader&, const CSaveWorld&); CRelayTracker(CBitStreamReader& in, const CSaveWorld& saveWorld);
bool HasRelay(TEditorId) const; bool HasRelay(TEditorId id) const;
void AddRelay(TEditorId); void AddRelay(TEditorId id);
void RemoveRelay(TEditorId); void RemoveRelay(TEditorId id);
void SendMsgs(TAreaId, CStateManager&); void SendMsgs(TAreaId areaId, CStateManager& stateMgr);
void PutTo(CBitStreamWriter&, const CSaveWorld&); void PutTo(CBitStreamWriter& out, const CSaveWorld& saveWorld);
}; };
} // namespace urde } // namespace urde