From f78c85f37cc84bf34b412f5eb1688f116b87b4a1 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 7 May 2020 11:39:09 -0400 Subject: [PATCH] CScriptWaypoint: Brace conditionals where applicable Makes the code consistent. --- Runtime/World/CScriptWaypoint.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/Runtime/World/CScriptWaypoint.cpp b/Runtime/World/CScriptWaypoint.cpp index 52c41f327..0171c0b58 100644 --- a/Runtime/World/CScriptWaypoint.cpp +++ b/Runtime/World/CScriptWaypoint.cpp @@ -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 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 wp = mgr.GetObjectById(id)) - if (wp->GetActive()) + const TUniqueId id = mgr.GetIdForScript(conn.x8_objId); + if (id != kInvalidUniqueId) { + if (const TCastToConstPtr 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)]; }