From 5e39147b767e18ca17a3fa7b61b5bd9a648c1efd Mon Sep 17 00:00:00 2001 From: deurklink Date: Sun, 20 Jan 2019 13:20:01 +0100 Subject: [PATCH] Fix #8584: Ducks spawning function doesnt check tiles 0..63 (original bug) (#8614) --- distribution/changelog.txt | 1 + src/openrct2/network/Network.cpp | 2 +- src/openrct2/scenario/Scenario.cpp | 10 ++++++---- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 71a4e6b81e..60427698c5 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -54,6 +54,7 @@ - Fix: [#8469] Crash modifying colour on hacked rides. - Fix: [#8508] Underground roto-drop is not going up. - Fix: [#8555] Multiplayer window text limits are not computed properly. +- Fix: [#8584] Duck spawning function does not check tiles with x or y coordinate of 0..63 (original bug). - Fix: [#8588] Guest list scrolling breaks above ~2000 guests. - Fix: [#8591] Game loop does not run at a consistent tick rate of 40 Hz. - Improved: [#2940] Allow mouse-dragging to set patrol area (Singleplayer only). diff --git a/src/openrct2/network/Network.cpp b/src/openrct2/network/Network.cpp index 1d99495b65..5afa1908cc 100644 --- a/src/openrct2/network/Network.cpp +++ b/src/openrct2/network/Network.cpp @@ -30,7 +30,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 "22" +#define NETWORK_STREAM_VERSION "23" #define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION static rct_peep* _pickup_peep = nullptr; diff --git a/src/openrct2/scenario/Scenario.cpp b/src/openrct2/scenario/Scenario.cpp index eaa6bf5862..f5a647fd07 100644 --- a/src/openrct2/scenario/Scenario.cpp +++ b/src/openrct2/scenario/Scenario.cpp @@ -426,11 +426,13 @@ static int32_t scenario_create_ducks() { int32_t i, j, r, c, x, y, waterZ, centreWaterZ, x2, y2; + // Originally, this function generated coordinates from 64 to 191. + // It now generates coordinates from 0 to 255, so smaller maps may also spawn ducks. r = scenario_rand(); - x = ((r >> 16) & 0xFFFF) & 0x7F; - y = (r & 0xFFFF) & 0x7F; - x = (x + 64) * 32; - y = (y + 64) * 32; + x = ((r >> 16) & 0xFFFF) % MAXIMUM_MAP_SIZE_TECHNICAL; + y = (r & 0xFFFF) % MAXIMUM_MAP_SIZE_TECHNICAL; + x = x * 32; + y = y * 32; if (!map_is_location_in_park({ x, y })) return 0;