From 869d1b398be9638cc6ddaf2b080ae3889f4f6318 Mon Sep 17 00:00:00 2001 From: Peter Froud Date: Sun, 24 Mar 2024 21:04:55 -0700 Subject: [PATCH] Assign variable in condition for documentation --- src/openrct2/actions/ParkSetEntranceFeeAction.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/openrct2/actions/ParkSetEntranceFeeAction.cpp b/src/openrct2/actions/ParkSetEntranceFeeAction.cpp index d506f09cf7..63cfebb965 100644 --- a/src/openrct2/actions/ParkSetEntranceFeeAction.cpp +++ b/src/openrct2/actions/ParkSetEntranceFeeAction.cpp @@ -42,19 +42,17 @@ void ParkSetEntranceFeeAction::Serialise(DataSerialiser& stream) GameActions::Result ParkSetEntranceFeeAction::Query() const { - if ((GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) != 0) + if (bool noMoney = (GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) != 0) { LOG_ERROR("Can't set park entrance fee because the park has no money"); return GameActions::Result(GameActions::Status::Disallowed, STR_ERR_CANT_CHANGE_PARK_ENTRANCE_FEE, STR_NONE); } - - if (!ParkEntranceFeeUnlocked()) + else if (bool forceFreeEntry = !ParkEntranceFeeUnlocked()) { LOG_ERROR("Park entrance fee is locked"); return GameActions::Result(GameActions::Status::Disallowed, STR_ERR_CANT_CHANGE_PARK_ENTRANCE_FEE, STR_NONE); } - - if (_fee < 0.00_GBP || _fee > MAX_ENTRANCE_FEE) + else if (_fee < 0.00_GBP || _fee > MAX_ENTRANCE_FEE) { LOG_ERROR("Invalid park entrance fee %d", _fee); return GameActions::Result(