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 {
CRelayTracker::CRelayTracker(CBitStreamReader& in, const CSaveWorld& saveworld) {
u32 relayCount = saveworld.GetRelayCount();
if (saveworld.GetRelayCount()) {
std::vector<bool> 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<bool> 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<bool> 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

View File

@ -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