CScriptWaypoint: Brace conditionals where applicable

Makes the code consistent.
This commit is contained in:
Lioncash 2020-05-07 11:39:09 -04:00
parent 717d422fc4
commit f78c85f37c
1 changed files with 13 additions and 7 deletions

View File

@ -38,9 +38,11 @@ void CScriptWaypoint::AddToRenderer(const zeus::CFrustum&, CStateManager&) {
}
TUniqueId CScriptWaypoint::FollowWaypoint(CStateManager& mgr) const {
for (const SConnection& conn : x20_conns)
if (conn.x0_state == EScriptObjectState::Arrived && conn.x4_msg == EScriptObjectMessage::Follow)
for (const SConnection& conn : x20_conns) {
if (conn.x0_state == EScriptObjectState::Arrived && conn.x4_msg == EScriptObjectMessage::Follow) {
return mgr.GetIdForScript(conn.x8_objId);
}
}
return kInvalidUniqueId;
}
@ -48,16 +50,20 @@ TUniqueId CScriptWaypoint::NextWaypoint(CStateManager& mgr) const {
rstl::reserved_vector<TUniqueId, 10> ids;
for (const SConnection& conn : x20_conns) {
if (conn.x0_state == EScriptObjectState::Arrived && conn.x4_msg == EScriptObjectMessage::Next) {
TUniqueId id = mgr.GetIdForScript(conn.x8_objId);
if (id != kInvalidUniqueId)
if (TCastToConstPtr<CScriptWaypoint> wp = mgr.GetObjectById(id))
if (wp->GetActive())
const TUniqueId id = mgr.GetIdForScript(conn.x8_objId);
if (id != kInvalidUniqueId) {
if (const TCastToConstPtr<CScriptWaypoint> wp = mgr.GetObjectById(id)) {
if (wp->GetActive()) {
ids.push_back(wp->GetUniqueId());
}
}
}
}
}
if (ids.size() == 0)
if (ids.empty()) {
return kInvalidUniqueId;
}
return ids[int(mgr.GetActiveRandom()->Float() * ids.size() * 0.99f)];
}