From da377e5b647f73c42e712d3e5b667ccb1aa4b38b Mon Sep 17 00:00:00 2001 From: duncanspumpkin Date: Mon, 11 Mar 2019 17:43:07 +0000 Subject: [PATCH] Add constants for min and max footpath height --- src/openrct2/actions/FootpathPlaceAction.hpp | 4 ++-- src/openrct2/actions/FootpathPlaceFromTrackAction.hpp | 4 ++-- src/openrct2/world/Footpath.h | 3 +++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/openrct2/actions/FootpathPlaceAction.hpp b/src/openrct2/actions/FootpathPlaceAction.hpp index e3c3a4b122..c52f73b337 100644 --- a/src/openrct2/actions/FootpathPlaceAction.hpp +++ b/src/openrct2/actions/FootpathPlaceAction.hpp @@ -79,12 +79,12 @@ public: return MakeResult(GA_ERROR::DISALLOWED, STR_CANT_BUILD_FOOTPATH_HERE, STR_LAND_SLOPE_UNSUITABLE); } - if (_loc.z / 8 < 2) + if (_loc.z / 8 < FootpathMinHeight) { return MakeResult(GA_ERROR::DISALLOWED, STR_CANT_BUILD_FOOTPATH_HERE, STR_TOO_LOW); } - if (_loc.z / 8 > 248) + if (_loc.z / 8 > FootpathMaxHeight) { return MakeResult(GA_ERROR::DISALLOWED, STR_CANT_BUILD_FOOTPATH_HERE, STR_TOO_HIGH); } diff --git a/src/openrct2/actions/FootpathPlaceFromTrackAction.hpp b/src/openrct2/actions/FootpathPlaceFromTrackAction.hpp index 41f4e50c19..0a1f675a3b 100644 --- a/src/openrct2/actions/FootpathPlaceFromTrackAction.hpp +++ b/src/openrct2/actions/FootpathPlaceFromTrackAction.hpp @@ -75,12 +75,12 @@ public: return MakeResult(GA_ERROR::DISALLOWED, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_LAND_NOT_OWNED_BY_PARK); } - if (_loc.z / 8 < 2) + if (_loc.z / 8 < FootpathMinHeight) { return MakeResult(GA_ERROR::DISALLOWED, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_TOO_LOW); } - if (_loc.z / 8 > 248) + if (_loc.z / 8 > FootpathMaxHeight) { return MakeResult(GA_ERROR::DISALLOWED, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_TOO_HIGH); } diff --git a/src/openrct2/world/Footpath.h b/src/openrct2/world/Footpath.h index e3e6f1bb68..79ba0f6dbb 100644 --- a/src/openrct2/world/Footpath.h +++ b/src/openrct2/world/Footpath.h @@ -21,6 +21,9 @@ enum PROVISIONAL_PATH_FLAG_2 = (1 << 2), }; +constexpr auto FootpathMaxHeight = 248; +constexpr auto FootpathMinHeight = 2; + #define FOOTPATH_ELEMENT_INSERT_QUEUE 0x80 #pragma pack(push, 1)