diff --git a/contributors.md b/contributors.md index dc2746b504..c9b4c8567f 100644 --- a/contributors.md +++ b/contributors.md @@ -263,6 +263,7 @@ Appreciation for contributors who have provided substantial work, but are no lon * Sjoerd de Bruin (sjoerddebruin) * Alex Harvey (loonyduck1) * Daniel Rödl (danielroedl) +* Michael Hlas (mhlas7) ## Toolchain * (Balletie) - macOS diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 8c2b784274..1bdf6784f1 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -5,6 +5,7 @@ - Improved: [#26747] Exporting a sprite file now also outputs a JSON file, allowing for round-trip conversions. - Improved: [#26763] The ride colour/appearance tab now visually separates fields using group boxes. - Improved: [#26765] The ride operations tab now visually separates fields using group boxes. +- Fix: [#26639] Handymen could begin a task while another handyman was already doing the exact same task. - Fix: [#26756] Guests cannot puke or litter on sloped path. - Fix: [#26758] [Plugin] IPv6 addresses are reported incorrectly. - Fix: [#26775] Maze gets wrong intensity boost from size (0.02 per tile instead of 0.01 per 2 tiles). diff --git a/src/openrct2/entity/Staff.cpp b/src/openrct2/entity/Staff.cpp index 1989d35ae2..7d2ed477fe 100644 --- a/src/openrct2/entity/Staff.cpp +++ b/src/openrct2/entity/Staff.cpp @@ -387,6 +387,28 @@ namespace OpenRCT2 return nextDirection; } + static bool isHandymanAlreadyServicingTile(const CoordsXY& tile, PeepState state) + { + if (state == PeepState::watering) + { + for (auto* staff : EntityList()) + { + if (staff->State == PeepState::watering + && CoordsXY{ staff->NextLoc } + CoordsDirectionDelta[staff->Var37] == tile) + return true; + } + } + else + { + for (auto* staff : EntityTileList(tile)) + { + if (staff->State == state) + return true; + } + } + return false; + } + /** * * rct2: 0x006BF931 @@ -433,7 +455,8 @@ namespace OpenRCT2 { if (surfaceElement->CanGrassGrow() && (surfaceElement->GetGrassLength() & 0x7) >= GRASS_LENGTH_CLEAR_1) { - return chosenDirection; + if (!isHandymanAlreadyServicingTile(chosenTile, PeepState::mowing)) + return chosenDirection; } } } @@ -1507,6 +1530,9 @@ namespace OpenRCT2 } } + if (isHandymanAlreadyServicingTile(chosenLoc, PeepState::watering)) + continue; + SetState(PeepState::watering); Var37 = chosen_position; @@ -1575,6 +1601,9 @@ namespace OpenRCT2 if (chosen_position == 4) return false; + if (isHandymanAlreadyServicingTile(CoordsXY{ NextLoc }, PeepState::emptyingBin)) + return false; + Var37 = chosen_position; SetState(PeepState::emptyingBin); @@ -1602,7 +1631,8 @@ namespace OpenRCT2 auto surfaceElement = MapGetSurfaceElementAt(NextLoc); if (surfaceElement != nullptr && surfaceElement->CanGrassGrow()) { - if ((surfaceElement->GetGrassLength() & 0x7) >= GRASS_LENGTH_CLEAR_1) + if ((surfaceElement->GetGrassLength() & 0x7) >= GRASS_LENGTH_CLEAR_1 + && !isHandymanAlreadyServicingTile(CoordsXY{ NextLoc }, PeepState::mowing)) { SetState(PeepState::mowing); Var37 = 0; @@ -1632,6 +1662,9 @@ namespace OpenRCT2 if (z_diff >= 16) continue; + if (isHandymanAlreadyServicingTile(litter->getLocation(), PeepState::sweeping)) + continue; + SetState(PeepState::sweeping); Var37 = 0; diff --git a/src/openrct2/network/NetworkBase.cpp b/src/openrct2/network/NetworkBase.cpp index c28066514d..21fda352a5 100644 --- a/src/openrct2/network/NetworkBase.cpp +++ b/src/openrct2/network/NetworkBase.cpp @@ -48,7 +48,7 @@ // It is used for making sure only compatible builds get connected, even within // single OpenRCT2 version. -constexpr uint8_t kStreamVersion = 2; +constexpr uint8_t kStreamVersion = 3; const std::string kStreamID = std::string(kOpenRCT2Version) + "-" + std::to_string(kStreamVersion);