From 79dda7260a2bb5e1ff2d78afe82ed48b9e035964 Mon Sep 17 00:00:00 2001 From: Duncan Date: Mon, 11 May 2020 19:28:40 +0100 Subject: [PATCH] Fix #11695. Mechanics walking to 0,0 on entrance only (#11704) Mistake made when refactoring that meant that null locations were converted into tile 0, 0. I've fixed the general case but it is preferred to try avoid using null states for coordinates if at all possible. --- distribution/changelog.txt | 1 + src/openrct2/network/Network.cpp | 2 +- src/openrct2/world/Location.hpp | 19 +++++++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 78227bbfb6..457ce4c47a 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -27,6 +27,7 @@ - Fix: [#11455] Object Selection window cuts off scenery names. - Fix: [#11640] Objects with a blank description in one language do not fall back to other languages anymore. - Fix: [#11676] Spiral Roller Coaster has regular lift hill available. +- Fix: [#11695] Mechanics walk to tile 0, 0 at entrance only stations when trying to fix them. - Fix: RCT1 scenarios have more items in the object list than are present in the park or the research list. - Improved: [#6530] Allow water and land height changes on park borders. - Improved: [#11390] Build hash written to screenshot metadata. diff --git a/src/openrct2/network/Network.cpp b/src/openrct2/network/Network.cpp index bb874e4b0d..e2b006c719 100644 --- a/src/openrct2/network/Network.cpp +++ b/src/openrct2/network/Network.cpp @@ -32,7 +32,7 @@ // This string specifies which version of network stream current build uses. // It is used for making sure only compatible builds get connected, even within // single OpenRCT2 version. -#define NETWORK_STREAM_VERSION "14" +#define NETWORK_STREAM_VERSION "15" #define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION static Peep* _pickup_peep = nullptr; diff --git a/src/openrct2/world/Location.hpp b/src/openrct2/world/Location.hpp index 48d694ab54..34bd68ccd7 100644 --- a/src/openrct2/world/Location.hpp +++ b/src/openrct2/world/Location.hpp @@ -277,6 +277,13 @@ struct TileCoordsXY CoordsXY ToCoordsXY() const { + if (isNull()) + { + CoordsXY ret{}; + ret.setNull(); + return ret; + } + return { x * COORDS_XY_STEP, y * COORDS_XY_STEP }; } @@ -427,6 +434,12 @@ struct TileCoordsXYZ : public TileCoordsXY CoordsXYZ ToCoordsXYZ() const { + if (isNull()) + { + CoordsXYZ ret{}; + ret.setNull(); + return ret; + } return { x * COORDS_XY_STEP, y * COORDS_XY_STEP, z * COORDS_Z_STEP }; } }; @@ -585,6 +598,12 @@ struct TileCoordsXYZD : public TileCoordsXYZ CoordsXYZD ToCoordsXYZD() const { + if (isNull()) + { + CoordsXYZD ret{}; + ret.setNull(); + return ret; + } return { x * COORDS_XY_STEP, y * COORDS_XY_STEP, z * COORDS_Z_STEP, direction }; } };