From ad07b993c8141d185e67e754219fd00d74bd6012 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 29 Mar 2020 02:01:06 -0400 Subject: [PATCH] CHudFreeLookInterface: Collapse conditional within SetFreeLookState() Same behavior, less code. --- Runtime/GuiSys/CHudFreeLookInterface.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/Runtime/GuiSys/CHudFreeLookInterface.cpp b/Runtime/GuiSys/CHudFreeLookInterface.cpp index 1fc050c4c..2a29aa602 100644 --- a/Runtime/GuiSys/CHudFreeLookInterface.cpp +++ b/Runtime/GuiSys/CHudFreeLookInterface.cpp @@ -84,13 +84,9 @@ void CHudFreeLookInterface::SetFreeLookState(bool inFreeLook, bool lookControlHe x8c_basewidget_outlinesb->SetColor(color); } - if (totalInterp == 0.f) { - x74_basewidget_freelookleft->SetVisibility(false, ETraversalMode::Children); - x80_basewidget_freelookright->SetVisibility(false, ETraversalMode::Children); - } else { - x74_basewidget_freelookleft->SetVisibility(true, ETraversalMode::Children); - x80_basewidget_freelookright->SetVisibility(true, ETraversalMode::Children); - } + const bool visible = totalInterp != 0.0f; + x74_basewidget_freelookleft->SetVisibility(visible, ETraversalMode::Children); + x80_basewidget_freelookright->SetVisibility(visible, ETraversalMode::Children); } CHudFreeLookInterfaceXRay::CHudFreeLookInterfaceXRay(CGuiFrame& selHud, bool inFreeLook, bool lookControlHeld, @@ -146,10 +142,8 @@ void CHudFreeLookInterfaceXRay::SetFreeLookState(bool inFreeLook, bool lookContr color.a() = x1c_freeLookInterp; x24_basewidget_freelook->SetColor(color); - if (x1c_freeLookInterp == 0.f) - x24_basewidget_freelook->SetVisibility(false, ETraversalMode::Children); - else - x24_basewidget_freelook->SetVisibility(true, ETraversalMode::Children); + const bool visible = x1c_freeLookInterp != 0.0f; + x24_basewidget_freelook->SetVisibility(visible, ETraversalMode::Children); } } // namespace urde