From 3016701a98cf0d6c935d043f7ffd97e72f5e023b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=B6eh=20Matt?= <5415177+ZehMatt@users.noreply.github.com> Date: Thu, 28 Oct 2021 21:15:24 +0300 Subject: [PATCH 1/4] Prevent map_is_location_owned from overwriting the global error message --- src/openrct2/world/Map.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/openrct2/world/Map.cpp b/src/openrct2/world/Map.cpp index 87f6fe8f71..8dd5d2473b 100644 --- a/src/openrct2/world/Map.cpp +++ b/src/openrct2/world/Map.cpp @@ -786,8 +786,6 @@ bool map_is_location_owned(const CoordsXYZ& loc) } } } - - gGameCommandErrorText = STR_LAND_NOT_OWNED_BY_PARK; return false; } From 45c4ed2679a316a61ccb1c6a790947bdfb64c425 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=B6eh=20Matt?= <5415177+ZehMatt@users.noreply.github.com> Date: Thu, 28 Oct 2021 21:20:42 +0300 Subject: [PATCH 2/4] Fix error messages for when map_is_location_owned is false --- src/openrct2/actions/RideEntranceExitPlaceAction.cpp | 4 ++-- src/openrct2/actions/WallPlaceAction.cpp | 2 +- src/openrct2/peep/Peep.cpp | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/openrct2/actions/RideEntranceExitPlaceAction.cpp b/src/openrct2/actions/RideEntranceExitPlaceAction.cpp index 24b91608fa..bc1e02377d 100644 --- a/src/openrct2/actions/RideEntranceExitPlaceAction.cpp +++ b/src/openrct2/actions/RideEntranceExitPlaceAction.cpp @@ -93,7 +93,7 @@ GameActions::Result::Ptr RideEntranceExitPlaceAction::Query() const auto z = ride->stations[_stationNum].GetBaseZ(); if (!LocationValid(_loc) || (!gCheatsSandboxMode && !map_is_location_owned({ _loc, z }))) { - return MakeResult(GameActions::Status::NotOwned, errorTitle, STR_NONE); + return MakeResult(GameActions::Status::NotOwned, errorTitle, STR_LAND_NOT_OWNED_BY_PARK); } if (!MapCheckCapacityAndReorganise(_loc)) @@ -224,7 +224,7 @@ GameActions::Result::Ptr RideEntranceExitPlaceAction::TrackPlaceQuery(const Coor if (!gCheatsSandboxMode && !map_is_location_owned(loc)) { - return MakeResult(GameActions::Status::NotOwned, errorTitle, STR_NONE); + return MakeResult(GameActions::Status::NotOwned, errorTitle, STR_LAND_NOT_OWNED_BY_PARK); } if (!MapCheckCapacityAndReorganise(loc)) diff --git a/src/openrct2/actions/WallPlaceAction.cpp b/src/openrct2/actions/WallPlaceAction.cpp index 4b8c049010..d257136175 100644 --- a/src/openrct2/actions/WallPlaceAction.cpp +++ b/src/openrct2/actions/WallPlaceAction.cpp @@ -89,7 +89,7 @@ GameActions::Result::Ptr WallPlaceAction::Query() const } else if (!map_is_location_owned(_loc)) { - return MakeResult(GameActions::Status::NotOwned, STR_CANT_BUILD_THIS_HERE, STR_NONE); + return MakeResult(GameActions::Status::NotOwned, STR_CANT_BUILD_THIS_HERE, STR_LAND_NOT_OWNED_BY_PARK); } } else if (!_trackDesignDrawingPreview && (_loc.x > GetMapSizeMaxXY() || _loc.y > GetMapSizeMaxXY())) diff --git a/src/openrct2/peep/Peep.cpp b/src/openrct2/peep/Peep.cpp index 8b70c848fd..4666fb0db8 100644 --- a/src/openrct2/peep/Peep.cpp +++ b/src/openrct2/peep/Peep.cpp @@ -592,7 +592,8 @@ std::unique_ptr Peep::Place(const TileCoordsXYZ& location, if (!map_is_location_owned(destination)) { - return std::make_unique(GameActions::Status::NotOwned, STR_ERR_CANT_PLACE_PERSON_HERE, STR_NONE); + return std::make_unique( + GameActions::Status::NotOwned, STR_ERR_CANT_PLACE_PERSON_HERE, STR_LAND_NOT_OWNED_BY_PARK); } if (auto res = MapCanConstructAt({ destination, destination.z, destination.z + (1 * 8) }, { 0b1111, 0 }); From 14b6894e779eac8cb7231759d7eb1d7a711aa75b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=B6eh=20Matt?= <5415177+ZehMatt@users.noreply.github.com> Date: Thu, 28 Oct 2021 21:21:59 +0300 Subject: [PATCH 3/4] Remove overwriting error message in map_is_location_in_park --- src/openrct2/world/Map.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/openrct2/world/Map.cpp b/src/openrct2/world/Map.cpp index 8dd5d2473b..a8b1cc7d51 100644 --- a/src/openrct2/world/Map.cpp +++ b/src/openrct2/world/Map.cpp @@ -803,8 +803,6 @@ bool map_is_location_in_park(const CoordsXY& coords) if (surfaceElement->GetOwnership() & OWNERSHIP_OWNED) return true; } - - gGameCommandErrorText = STR_LAND_NOT_OWNED_BY_PARK; return false; } From 322e1203fcef75f45be4cc652b485622cbef9b2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=B6eh=20Matt?= <5415177+ZehMatt@users.noreply.github.com> Date: Thu, 28 Oct 2021 21:26:07 +0300 Subject: [PATCH 4/4] Fix error message for WallPlaceAction --- src/openrct2/actions/WallPlaceAction.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openrct2/actions/WallPlaceAction.cpp b/src/openrct2/actions/WallPlaceAction.cpp index d257136175..61587af65b 100644 --- a/src/openrct2/actions/WallPlaceAction.cpp +++ b/src/openrct2/actions/WallPlaceAction.cpp @@ -84,7 +84,7 @@ GameActions::Result::Ptr WallPlaceAction::Query() const { if (!map_is_location_in_park(_loc)) { - return MakeResult(GameActions::Status::NotOwned, STR_CANT_BUILD_THIS_HERE, STR_NONE); + return MakeResult(GameActions::Status::NotOwned, STR_CANT_BUILD_THIS_HERE, STR_LAND_NOT_OWNED_BY_PARK); } } else if (!map_is_location_owned(_loc))