diff --git a/src/openrct2-ui/windows/MazeConstruction.cpp b/src/openrct2-ui/windows/MazeConstruction.cpp index 77a65c1111..d2ca729403 100644 --- a/src/openrct2-ui/windows/MazeConstruction.cpp +++ b/src/openrct2-ui/windows/MazeConstruction.cpp @@ -535,7 +535,8 @@ static void WindowMazeConstructionConstruct(int32_t direction) break; } - money32 cost = maze_set_track(x, y, z, flags, false, direction, _currentRideIndex, mode); + money32 cost = maze_set_track( + CoordsXYZD{ x, y, z, static_cast(direction) }, flags, false, _currentRideIndex, mode); if (cost == MONEY32_UNDEFINED) { return; diff --git a/src/openrct2-ui/windows/RideConstruction.cpp b/src/openrct2-ui/windows/RideConstruction.cpp index 45d54442f6..c1f9bbb207 100644 --- a/src/openrct2-ui/windows/RideConstruction.cpp +++ b/src/openrct2-ui/windows/RideConstruction.cpp @@ -3772,8 +3772,7 @@ void ride_construction_tooldown_construct(const ScreenCoordsXY& screenCoords) gDisableErrorWindowSound = true; _trackPlaceCost = maze_set_track( - _currentTrackBegin.x, _currentTrackBegin.y, _currentTrackBegin.z, GAME_COMMAND_FLAG_APPLY, true, 0, - _currentRideIndex, GC_SET_MAZE_TRACK_BUILD); + CoordsXYZD{ _currentTrackBegin, 0 }, GAME_COMMAND_FLAG_APPLY, true, _currentRideIndex, GC_SET_MAZE_TRACK_BUILD); gDisableErrorWindowSound = false; diff --git a/src/openrct2/actions/GameActionCompat.cpp b/src/openrct2/actions/GameActionCompat.cpp index 86638b3de0..1e188d7ab3 100644 --- a/src/openrct2/actions/GameActionCompat.cpp +++ b/src/openrct2/actions/GameActionCompat.cpp @@ -118,11 +118,9 @@ void guest_set_name(uint16_t spriteIndex, const char* name) #pragma endregion #pragma region MazeSetTrack -money32 maze_set_track( - uint16_t x, uint16_t y, uint16_t z, uint8_t flags, bool initialPlacement, uint8_t direction, ride_id_t rideIndex, - uint8_t mode) +money32 maze_set_track(const CoordsXYZD& loc, uint8_t flags, bool initialPlacement, ride_id_t rideIndex, uint8_t mode) { - auto gameAction = MazeSetTrackAction({ x, y, z, direction }, initialPlacement, rideIndex, mode); + auto gameAction = MazeSetTrackAction(loc, initialPlacement, rideIndex, mode); gameAction.SetFlags(flags); GameActions::Result res; diff --git a/src/openrct2/actions/MazeSetTrackAction.cpp b/src/openrct2/actions/MazeSetTrackAction.cpp index 15e6d444d6..146d10801f 100644 --- a/src/openrct2/actions/MazeSetTrackAction.cpp +++ b/src/openrct2/actions/MazeSetTrackAction.cpp @@ -207,7 +207,7 @@ GameActions::Result MazeSetTrackAction::Execute() const { case GC_SET_MAZE_TRACK_BUILD: { - uint8_t segmentOffset = MazeGetSegmentBit(_loc.x, _loc.y); + uint8_t segmentOffset = MazeGetSegmentBit(_loc); tileElement->AsTrack()->MazeEntrySubtract(1 << segmentOffset); @@ -259,7 +259,7 @@ GameActions::Result MazeSetTrackAction::Execute() const return res; } - uint32_t segmentBit = MazeGetSegmentBit(previousSegment.x, previousSegment.y); + uint32_t segmentBit = MazeGetSegmentBit(previousSegment); tileElement->AsTrack()->MazeEntryAdd(1 << segmentBit); segmentBit--; @@ -302,10 +302,10 @@ GameActions::Result MazeSetTrackAction::Execute() const return res; } -uint8_t MazeSetTrackAction::MazeGetSegmentBit(uint16_t x, uint16_t y) const +uint8_t MazeSetTrackAction::MazeGetSegmentBit(const CoordsXY& coords) const { - uint8_t minorX = x & 0x1F; // 0 or 16 - uint8_t minorY = y & 0x1F; // 0 or 16 + uint8_t minorX = coords.x & 0x1F; + uint8_t minorY = coords.y & 0x1F; if (minorX == 0 && minorY == 0) { diff --git a/src/openrct2/actions/MazeSetTrackAction.h b/src/openrct2/actions/MazeSetTrackAction.h index 912191f2bc..271831a6a7 100644 --- a/src/openrct2/actions/MazeSetTrackAction.h +++ b/src/openrct2/actions/MazeSetTrackAction.h @@ -55,5 +55,5 @@ public: GameActions::Result Execute() const override; private: - uint8_t MazeGetSegmentBit(uint16_t x, uint16_t y) const; + uint8_t MazeGetSegmentBit(const CoordsXY&) const; }; diff --git a/src/openrct2/network/NetworkBase.cpp b/src/openrct2/network/NetworkBase.cpp index 10db659590..6360e73aee 100644 --- a/src/openrct2/network/NetworkBase.cpp +++ b/src/openrct2/network/NetworkBase.cpp @@ -40,7 +40,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 "8" +#define NETWORK_STREAM_VERSION "9" #define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION static Peep* _pickup_peep = nullptr; diff --git a/src/openrct2/ride/RideConstruction.cpp b/src/openrct2/ride/RideConstruction.cpp index c0befc08ac..5fd8ba654a 100644 --- a/src/openrct2/ride/RideConstruction.cpp +++ b/src/openrct2/ride/RideConstruction.cpp @@ -492,10 +492,10 @@ void ride_remove_provisional_track_piece() { int32_t flags = GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_NO_SPEND | GAME_COMMAND_FLAG_GHOST; - maze_set_track(x, y, z, flags, false, 0, rideIndex, GC_SET_MAZE_TRACK_FILL); - maze_set_track(x, y + 16, z, flags, false, 1, rideIndex, GC_SET_MAZE_TRACK_FILL); - maze_set_track(x + 16, y + 16, z, flags, false, 2, rideIndex, GC_SET_MAZE_TRACK_FILL); - maze_set_track(x + 16, y, z, flags, false, 3, rideIndex, GC_SET_MAZE_TRACK_FILL); + maze_set_track(CoordsXYZD{ x, y, z, 0 }, flags, false, rideIndex, GC_SET_MAZE_TRACK_FILL); + maze_set_track(CoordsXYZD{ x, y + 16, z, 1 }, flags, false, rideIndex, GC_SET_MAZE_TRACK_FILL); + maze_set_track(CoordsXYZD{ x + 16, y + 16, z, 2 }, flags, false, rideIndex, GC_SET_MAZE_TRACK_FILL); + maze_set_track(CoordsXYZD{ x + 16, y, z, 3 }, flags, false, rideIndex, GC_SET_MAZE_TRACK_FILL); } else { diff --git a/src/openrct2/ride/Track.h b/src/openrct2/ride/Track.h index d2256bc979..7b9e78a007 100644 --- a/src/openrct2/ride/Track.h +++ b/src/openrct2/ride/Track.h @@ -577,8 +577,6 @@ roll_type_t track_get_actual_bank_3(bool useInvertedSprites, TileElement* tileEl bool track_add_station_element(CoordsXYZD loc, ride_id_t rideIndex, int32_t flags, bool fromTrackDesign); bool track_remove_station_element(const CoordsXYZD& loc, ride_id_t rideIndex, int32_t flags); -money32 maze_set_track( - uint16_t x, uint16_t y, uint16_t z, uint8_t flags, bool initialPlacement, uint8_t direction, ride_id_t rideIndex, - uint8_t mode); +money32 maze_set_track(const CoordsXYZD& coords, uint8_t flags, bool initialPlacement, ride_id_t rideIndex, uint8_t mode); bool TrackTypeHasSpeedSetting(track_type_t trackType); diff --git a/src/openrct2/windows/_legacy.cpp b/src/openrct2/windows/_legacy.cpp index 69c3911ba2..3a908f9d1d 100644 --- a/src/openrct2/windows/_legacy.cpp +++ b/src/openrct2/windows/_legacy.cpp @@ -57,7 +57,7 @@ money32 place_provisional_track_piece( { int32_t flags = GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_NO_SPEND | GAME_COMMAND_FLAG_GHOST; // 105 - auto result = maze_set_track(trackPos.x, trackPos.y, trackPos.z, flags, true, 0, rideIndex, GC_SET_MAZE_TRACK_BUILD); + auto result = maze_set_track(CoordsXYZD{ trackPos, 0 }, flags, true, rideIndex, GC_SET_MAZE_TRACK_BUILD); if (result == MONEY32_UNDEFINED) return result;