diff --git a/CMakeLists.txt b/CMakeLists.txt index 1855b99c82..2a4515e36a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -76,9 +76,9 @@ set(OPENMSX_VERSION "1.0.1") set(OPENMSX_URL "https://github.com/OpenRCT2/OpenMusic/releases/download/v${OPENMSX_VERSION}/openmusic.zip") set(OPENMSX_SHA1 "8ff94490180e2fbfdd13a4130eb300da726ca406") -set(REPLAYS_VERSION "0.0.73") +set(REPLAYS_VERSION "0.0.74") set(REPLAYS_URL "https://github.com/OpenRCT2/replays/releases/download/v${REPLAYS_VERSION}/replays.zip") -set(REPLAYS_SHA1 "5AAFEE5DBEFACA454004742CECCC99E5DD3FD4F7") +set(REPLAYS_SHA1 "7AB14AB3B991BA4214E53BB0B0838D254C1E7BA6") option(FORCE32 "Force 32-bit build. It will add `-m32` to compiler flags.") option(WITH_TESTS "Build tests") diff --git a/openrct2.proj b/openrct2.proj index 6d7b3f4e6c..32537fe58a 100644 --- a/openrct2.proj +++ b/openrct2.proj @@ -51,8 +51,8 @@ 8f04aea33f8034131c3069f6accacce0d94f80c1 https://github.com/OpenRCT2/OpenMusic/releases/download/v1.0.1/openmusic.zip 8ff94490180e2fbfdd13a4130eb300da726ca406 - https://github.com/OpenRCT2/replays/releases/download/v0.0.73/replays.zip - 5AAFEE5DBEFACA454004742CECCC99E5DD3FD4F7 + https://github.com/OpenRCT2/replays/releases/download/v0.0.74/replays.zip + 7AB14AB3B991BA4214E53BB0B0838D254C1E7BA6 diff --git a/src/openrct2-ui/windows/Cheats.cpp b/src/openrct2-ui/windows/Cheats.cpp index d5d37fc14a..c050ee1fd4 100644 --- a/src/openrct2-ui/windows/Cheats.cpp +++ b/src/openrct2-ui/windows/Cheats.cpp @@ -698,12 +698,12 @@ private: switch (widgetIndex) { case WIDX_MONEY_SPINNER_INCREMENT: - _moneySpinnerValue = AddClamp_money32( + _moneySpinnerValue = AddClamp_money64( CHEATS_MONEY_INCREMENT_DIV * (_moneySpinnerValue / CHEATS_MONEY_INCREMENT_DIV), CHEATS_MONEY_INCREMENT_DIV); InvalidateWidget(WIDX_MONEY_SPINNER); break; case WIDX_MONEY_SPINNER_DECREMENT: - _moneySpinnerValue = AddClamp_money32( + _moneySpinnerValue = AddClamp_money64( CHEATS_MONEY_INCREMENT_DIV * (_moneySpinnerValue / CHEATS_MONEY_INCREMENT_DIV), -CHEATS_MONEY_INCREMENT_DIV); InvalidateWidget(WIDX_MONEY_SPINNER); diff --git a/src/openrct2-ui/windows/DemolishRidePrompt.cpp b/src/openrct2-ui/windows/DemolishRidePrompt.cpp index 84f196ed5c..555c023d41 100644 --- a/src/openrct2-ui/windows/DemolishRidePrompt.cpp +++ b/src/openrct2-ui/windows/DemolishRidePrompt.cpp @@ -42,7 +42,7 @@ static Widget window_ride_demolish_widgets[] = class DemolishRidePromptWindow final : public Window { - money32 _demolishRideCost; + money64 _demolishRideCost; public: void SetRide(const Ride& currentRide) diff --git a/src/openrct2-ui/windows/Footpath.cpp b/src/openrct2-ui/windows/Footpath.cpp index f63d68eaca..486d195137 100644 --- a/src/openrct2-ui/windows/Footpath.cpp +++ b/src/openrct2-ui/windows/Footpath.cpp @@ -154,7 +154,7 @@ private: std::vector> _dropdownEntries; - money32 _windowFootpathCost; + money64 _windowFootpathCost; uint32_t _footpathConstructionNextArrowPulse = 0; uint8_t _lastUpdatedCameraRotation = UINT8_MAX; bool _footpathErrorOccured = false; @@ -290,7 +290,7 @@ public: break; } - _windowFootpathCost = MONEY32_UNDEFINED; + _windowFootpathCost = MONEY64_UNDEFINED; ToolCancel(); FootpathProvisionalUpdate(); MapInvalidateMapSelectionTiles(); @@ -307,7 +307,7 @@ public: break; } - _windowFootpathCost = MONEY32_UNDEFINED; + _windowFootpathCost = MONEY64_UNDEFINED; ToolCancel(); FootpathProvisionalUpdate(); MapInvalidateMapSelectionTiles(); @@ -363,7 +363,7 @@ public: } FootpathProvisionalUpdate(); - _windowFootpathCost = MONEY32_UNDEFINED; + _windowFootpathCost = MONEY64_UNDEFINED; Invalidate(); } @@ -496,7 +496,7 @@ public: screenCoords = this->windowPos + ScreenCoordsXY{ window_footpath_widgets[WIDX_CONSTRUCT].midX(), window_footpath_widgets[WIDX_CONSTRUCT].bottom - 12 }; - if (_windowFootpathCost != MONEY32_UNDEFINED) + if (_windowFootpathCost != MONEY64_UNDEFINED) { if (!(gParkFlags & PARK_FLAGS_NO_MONEY)) { @@ -751,7 +751,7 @@ private: { FootpathProvisionalUpdate(); _footpathConstructDirection = (direction - GetCurrentRotation()) & 3; - _windowFootpathCost = MONEY32_UNDEFINED; + _windowFootpathCost = MONEY64_UNDEFINED; WindowFootpathSetEnabledAndPressedWidgets(); } @@ -763,7 +763,7 @@ private: { FootpathProvisionalUpdate(); gFootpathConstructSlope = slope; - _windowFootpathCost = MONEY32_UNDEFINED; + _windowFootpathCost = MONEY64_UNDEFINED; WindowFootpathSetEnabledAndPressedWidgets(); } @@ -1020,7 +1020,7 @@ private: */ void WindowFootpathConstruct() { - _windowFootpathCost = MONEY32_UNDEFINED; + _windowFootpathCost = MONEY64_UNDEFINED; FootpathProvisionalUpdate(); ObjectEntryIndex type; @@ -1176,7 +1176,7 @@ private: { TileElement* tileElement; - _windowFootpathCost = MONEY32_UNDEFINED; + _windowFootpathCost = MONEY64_UNDEFINED; FootpathProvisionalUpdate(); tileElement = FootpathGetTileElementToRemove(); diff --git a/src/openrct2-ui/windows/LandRights.cpp b/src/openrct2-ui/windows/LandRights.cpp index 8faf882713..708f3d13ed 100644 --- a/src/openrct2-ui/windows/LandRights.cpp +++ b/src/openrct2-ui/windows/LandRights.cpp @@ -225,7 +225,7 @@ public: } // Draw cost amount - if (_landRightsCost != MONEY32_UNDEFINED && _landRightsCost != 0 && !(gParkFlags & PARK_FLAGS_NO_MONEY)) + if (_landRightsCost != MONEY64_UNDEFINED && _landRightsCost != 0 && !(gParkFlags & PARK_FLAGS_NO_MONEY)) { auto ft = Formatter(); ft.Add(_landRightsCost); @@ -244,9 +244,9 @@ public: if (!mapTile.has_value()) { - if (_landRightsCost != MONEY32_UNDEFINED) + if (_landRightsCost != MONEY64_UNDEFINED) { - _landRightsCost = MONEY32_UNDEFINED; + _landRightsCost = MONEY64_UNDEFINED; WindowInvalidateByClass(WindowClass::ClearScenery); } return; @@ -314,7 +314,7 @@ public: : LandBuyRightSetting::BuyConstructionRights); auto res = GameActions::Query(&landBuyRightsAction); - _landRightsCost = res.Error == GameActions::Status::Ok ? res.Cost : MONEY32_UNDEFINED; + _landRightsCost = res.Error == GameActions::Status::Ok ? res.Cost : MONEY64_UNDEFINED; } void OnToolAbort(WidgetIndex widgetIndex) override @@ -379,7 +379,7 @@ public: private: uint8_t _landRightsMode; - money32 _landRightsCost; + money64 _landRightsCost; void InputSize() { diff --git a/src/openrct2-ui/windows/Park.cpp b/src/openrct2-ui/windows/Park.cpp index 7aa89fe9f0..0775a13874 100644 --- a/src/openrct2-ui/windows/Park.cpp +++ b/src/openrct2-ui/windows/Park.cpp @@ -826,14 +826,14 @@ private: case WIDX_INCREASE_PRICE: { const auto newFee = std::min(MAX_ENTRANCE_FEE, gParkEntranceFee + 1.00_GBP); - auto gameAction = ParkSetEntranceFeeAction(static_cast(newFee)); + auto gameAction = ParkSetEntranceFeeAction(newFee); GameActions::Execute(&gameAction); break; } case WIDX_DECREASE_PRICE: { const auto newFee = std::max(0.00_GBP, gParkEntranceFee - 1.00_GBP); - auto gameAction = ParkSetEntranceFeeAction(static_cast(newFee)); + auto gameAction = ParkSetEntranceFeeAction(newFee); GameActions::Execute(&gameAction); break; } diff --git a/src/openrct2-ui/windows/RefurbishRidePrompt.cpp b/src/openrct2-ui/windows/RefurbishRidePrompt.cpp index ee9cbab032..d5be63fb17 100644 --- a/src/openrct2-ui/windows/RefurbishRidePrompt.cpp +++ b/src/openrct2-ui/windows/RefurbishRidePrompt.cpp @@ -41,7 +41,7 @@ static Widget window_ride_refurbish_widgets[] = class RefurbishRidePromptWindow final : public Window { - money32 _demolishRideCost; + money64 _demolishRideCost; public: void SetRide(const Ride& currentRide) diff --git a/src/openrct2-ui/windows/Ride.cpp b/src/openrct2-ui/windows/Ride.cpp index fced7c5ab3..e35cfcc001 100644 --- a/src/openrct2-ui/windows/Ride.cpp +++ b/src/openrct2-ui/windows/Ride.cpp @@ -6394,7 +6394,7 @@ static void WindowRideIncomeToggleSecondaryPrice(WindowBase* w) GameActions::Execute(&rideSetPriceAction); } -static void WindowRideIncomeSetPrimaryPrice(WindowBase* w, money16 price) +static void WindowRideIncomeSetPrimaryPrice(WindowBase* w, money64 price) { auto rideSetPriceAction = RideSetPriceAction(w->rideId, price, true); GameActions::Execute(&rideSetPriceAction); @@ -6413,7 +6413,7 @@ static void WindowRideIncomeIncreasePrimaryPrice(WindowBase* w) if (ride == nullptr) return; - money16 price = ride->price[0]; + auto price = ride->price[0]; if (price < 20.00_GBP) price++; @@ -6433,7 +6433,7 @@ static void WindowRideIncomeDecreasePrimaryPrice(WindowBase* w) if (ride == nullptr) return; - money16 price = ride->price[0]; + auto price = ride->price[0]; if (price > 0.00_GBP) price--; @@ -6449,7 +6449,7 @@ static money64 WindowRideIncomeGetSecondaryPrice(WindowBase* w) return ride->price[1]; } -static void WindowRideIncomeSetSecondaryPrice(WindowBase* w, money16 price) +static void WindowRideIncomeSetSecondaryPrice(WindowBase* w, money64 price) { auto rideSetPriceAction = RideSetPriceAction(w->rideId, price, false); GameActions::Execute(&rideSetPriceAction); @@ -6526,7 +6526,7 @@ static void WindowRideIncomeMouseup(WindowBase* w, WidgetIndex widgetIndex) auto ride = GetRide(w->rideId); if (ride != nullptr) { - MoneyToString(static_cast(ride->price[0]), _moneyInputText, MONEY_STRING_MAXLENGTH, true); + MoneyToString(ride->price[0], _moneyInputText, MONEY_STRING_MAXLENGTH, true); WindowTextInputRawOpen( w, WIDX_PRIMARY_PRICE, STR_ENTER_NEW_VALUE, STR_ENTER_NEW_VALUE, {}, _moneyInputText, MONEY_STRING_MAXLENGTH); @@ -6613,15 +6613,14 @@ static void WindowRideIncomeTextinput(WindowBase* w, WidgetIndex widgetIndex, co } price = std::clamp(price, 0.00_GBP, 20.00_GBP); - money16 price16 = static_cast(price); if (widgetIndex == WIDX_PRIMARY_PRICE) { - WindowRideIncomeSetPrimaryPrice(w, price16); + WindowRideIncomeSetPrimaryPrice(w, price); } else { - WindowRideIncomeSetSecondaryPrice(w, price16); + WindowRideIncomeSetSecondaryPrice(w, price); } } @@ -6675,7 +6674,7 @@ static void WindowRideIncomeInvalidate(WindowBase* w) window_ride_income_widgets[WIDX_PRIMARY_PRICE_SAME_THROUGHOUT_PARK].type = WindowWidgetType::Empty; window_ride_income_widgets[WIDX_PRIMARY_PRICE].text = STR_BOTTOM_TOOLBAR_CASH; - money16 ridePrimaryPrice = RideGetPrice(*ride); + auto ridePrimaryPrice = RideGetPrice(*ride); ft.Rewind(); ft.Add(ridePrimaryPrice); if (ridePrimaryPrice == 0) @@ -6821,7 +6820,7 @@ static void WindowRideIncomePaint(WindowBase* w, DrawPixelInfo* dpi) // Running cost per hour money64 costPerHour = ride->upkeep_cost * 16; - stringId = ride->upkeep_cost == MONEY16_UNDEFINED ? STR_RUNNING_COST_UNKNOWN : STR_RUNNING_COST_PER_HOUR; + stringId = ride->upkeep_cost == MONEY64_UNDEFINED ? STR_RUNNING_COST_UNKNOWN : STR_RUNNING_COST_PER_HOUR; auto ft = Formatter(); ft.Add(costPerHour); DrawTextBasic(*dpi, screenCoords, stringId, ft); diff --git a/src/openrct2-ui/windows/RideConstruction.cpp b/src/openrct2-ui/windows/RideConstruction.cpp index bfa578008a..b0719fed0a 100644 --- a/src/openrct2-ui/windows/RideConstruction.cpp +++ b/src/openrct2-ui/windows/RideConstruction.cpp @@ -159,7 +159,7 @@ static bool _trackPlaceShiftState; static ScreenCoordsXY _trackPlaceShiftStart; static int32_t _trackPlaceShiftZ; static int32_t _trackPlaceZ; -static money32 _trackPlaceCost; +static money64 _trackPlaceCost; static StringId _trackPlaceErrorMessage; static bool _autoRotatingShop; static bool _gotoStartPlacementMode = false; @@ -222,7 +222,7 @@ public: WindowPushOthersRight(*this); ShowGridlines(); - _currentTrackPrice = MONEY32_UNDEFINED; + _currentTrackPrice = MONEY64_UNDEFINED; _currentBrakeSpeed2 = 8; _currentSeatRotationAngle = 4; @@ -988,49 +988,49 @@ public: case WIDX_LEFT_CURVE: RideConstructionInvalidateCurrentTrack(); _currentTrackCurve = TRACK_CURVE_LEFT; - _currentTrackPrice = MONEY32_UNDEFINED; + _currentTrackPrice = MONEY64_UNDEFINED; WindowRideConstructionUpdateActiveElements(); break; case WIDX_RIGHT_CURVE: RideConstructionInvalidateCurrentTrack(); _currentTrackCurve = TRACK_CURVE_RIGHT; - _currentTrackPrice = MONEY32_UNDEFINED; + _currentTrackPrice = MONEY64_UNDEFINED; WindowRideConstructionUpdateActiveElements(); break; case WIDX_LEFT_CURVE_SMALL: RideConstructionInvalidateCurrentTrack(); _currentTrackCurve = TRACK_CURVE_LEFT_SMALL; - _currentTrackPrice = MONEY32_UNDEFINED; + _currentTrackPrice = MONEY64_UNDEFINED; WindowRideConstructionUpdateActiveElements(); break; case WIDX_RIGHT_CURVE_SMALL: RideConstructionInvalidateCurrentTrack(); _currentTrackCurve = TRACK_CURVE_RIGHT_SMALL; - _currentTrackPrice = MONEY32_UNDEFINED; + _currentTrackPrice = MONEY64_UNDEFINED; WindowRideConstructionUpdateActiveElements(); break; case WIDX_LEFT_CURVE_VERY_SMALL: RideConstructionInvalidateCurrentTrack(); _currentTrackCurve = TRACK_CURVE_LEFT_VERY_SMALL; - _currentTrackPrice = MONEY32_UNDEFINED; + _currentTrackPrice = MONEY64_UNDEFINED; WindowRideConstructionUpdateActiveElements(); break; case WIDX_RIGHT_CURVE_VERY_SMALL: RideConstructionInvalidateCurrentTrack(); _currentTrackCurve = TRACK_CURVE_RIGHT_VERY_SMALL; - _currentTrackPrice = MONEY32_UNDEFINED; + _currentTrackPrice = MONEY64_UNDEFINED; WindowRideConstructionUpdateActiveElements(); break; case WIDX_LEFT_CURVE_LARGE: RideConstructionInvalidateCurrentTrack(); _currentTrackCurve = TRACK_CURVE_LEFT_LARGE; - _currentTrackPrice = MONEY32_UNDEFINED; + _currentTrackPrice = MONEY64_UNDEFINED; WindowRideConstructionUpdateActiveElements(); break; case WIDX_RIGHT_CURVE_LARGE: RideConstructionInvalidateCurrentTrack(); _currentTrackCurve = TRACK_CURVE_RIGHT_LARGE; - _currentTrackPrice = MONEY32_UNDEFINED; + _currentTrackPrice = MONEY64_UNDEFINED; WindowRideConstructionUpdateActiveElements(); break; case WIDX_STRAIGHT: @@ -1038,7 +1038,7 @@ public: if (_currentTrackCurve != TRACK_CURVE_NONE) _currentTrackBankEnd = TRACK_BANK_NONE; _currentTrackCurve = TRACK_CURVE_NONE; - _currentTrackPrice = MONEY32_UNDEFINED; + _currentTrackPrice = MONEY64_UNDEFINED; WindowRideConstructionUpdateActiveElements(); break; case WIDX_SLOPE_DOWN_STEEP: @@ -1048,7 +1048,7 @@ public: if (_currentTrackCurve == TRACK_CURVE_LEFT && _currentTrackBankEnd == TRACK_BANK_LEFT) { _currentTrackCurve = TrackElemType::LeftHalfBankedHelixDownLarge | RideConstructionSpecialPieceSelected; - _currentTrackPrice = MONEY32_UNDEFINED; + _currentTrackPrice = MONEY64_UNDEFINED; WindowRideConstructionUpdateActiveElements(); break; } @@ -1056,14 +1056,14 @@ public: { _currentTrackCurve = TrackElemType::RightHalfBankedHelixDownLarge | RideConstructionSpecialPieceSelected; - _currentTrackPrice = MONEY32_UNDEFINED; + _currentTrackPrice = MONEY64_UNDEFINED; WindowRideConstructionUpdateActiveElements(); break; } if (_currentTrackCurve == TRACK_CURVE_LEFT_SMALL && _currentTrackBankEnd == TRACK_BANK_LEFT) { _currentTrackCurve = TrackElemType::LeftHalfBankedHelixDownSmall | RideConstructionSpecialPieceSelected; - _currentTrackPrice = MONEY32_UNDEFINED; + _currentTrackPrice = MONEY64_UNDEFINED; WindowRideConstructionUpdateActiveElements(); break; } @@ -1071,7 +1071,7 @@ public: { _currentTrackCurve = TrackElemType::RightHalfBankedHelixDownSmall | RideConstructionSpecialPieceSelected; - _currentTrackPrice = MONEY32_UNDEFINED; + _currentTrackPrice = MONEY64_UNDEFINED; WindowRideConstructionUpdateActiveElements(); break; } @@ -1082,7 +1082,7 @@ public: { _currentTrackCurve = TrackElemType::LeftQuarterBankedHelixLargeDown | RideConstructionSpecialPieceSelected; - _currentTrackPrice = MONEY32_UNDEFINED; + _currentTrackPrice = MONEY64_UNDEFINED; WindowRideConstructionUpdateActiveElements(); break; } @@ -1090,7 +1090,7 @@ public: { _currentTrackCurve = TrackElemType::RightQuarterBankedHelixLargeDown | RideConstructionSpecialPieceSelected; - _currentTrackPrice = MONEY32_UNDEFINED; + _currentTrackPrice = MONEY64_UNDEFINED; WindowRideConstructionUpdateActiveElements(); break; } @@ -1103,7 +1103,7 @@ public: { _currentTrackCurve = TrackElemType::LeftQuarterHelixLargeDown | RideConstructionSpecialPieceSelected; - _currentTrackPrice = MONEY32_UNDEFINED; + _currentTrackPrice = MONEY64_UNDEFINED; WindowRideConstructionUpdateActiveElements(); break; } @@ -1111,7 +1111,7 @@ public: { _currentTrackCurve = TrackElemType::RightQuarterHelixLargeDown | RideConstructionSpecialPieceSelected; - _currentTrackPrice = MONEY32_UNDEFINED; + _currentTrackPrice = MONEY64_UNDEFINED; WindowRideConstructionUpdateActiveElements(); break; } @@ -1186,28 +1186,28 @@ public: if (_currentTrackCurve == TRACK_CURVE_LEFT && _currentTrackBankEnd == TRACK_BANK_LEFT) { _currentTrackCurve = TrackElemType::LeftHalfBankedHelixUpLarge | RideConstructionSpecialPieceSelected; - _currentTrackPrice = MONEY32_UNDEFINED; + _currentTrackPrice = MONEY64_UNDEFINED; WindowRideConstructionUpdateActiveElements(); break; } if (_currentTrackCurve == TRACK_CURVE_RIGHT && _currentTrackBankEnd == TRACK_BANK_RIGHT) { _currentTrackCurve = TrackElemType::RightHalfBankedHelixUpLarge | RideConstructionSpecialPieceSelected; - _currentTrackPrice = MONEY32_UNDEFINED; + _currentTrackPrice = MONEY64_UNDEFINED; WindowRideConstructionUpdateActiveElements(); break; } if (_currentTrackCurve == TRACK_CURVE_LEFT_SMALL && _currentTrackBankEnd == TRACK_BANK_LEFT) { _currentTrackCurve = TrackElemType::LeftHalfBankedHelixUpSmall | RideConstructionSpecialPieceSelected; - _currentTrackPrice = MONEY32_UNDEFINED; + _currentTrackPrice = MONEY64_UNDEFINED; WindowRideConstructionUpdateActiveElements(); break; } if (_currentTrackCurve == TRACK_CURVE_RIGHT_SMALL && _currentTrackBankEnd == TRACK_BANK_RIGHT) { _currentTrackCurve = TrackElemType::RightHalfBankedHelixUpSmall | RideConstructionSpecialPieceSelected; - _currentTrackPrice = MONEY32_UNDEFINED; + _currentTrackPrice = MONEY64_UNDEFINED; WindowRideConstructionUpdateActiveElements(); break; } @@ -1218,7 +1218,7 @@ public: { _currentTrackCurve = TrackElemType::LeftQuarterBankedHelixLargeUp | RideConstructionSpecialPieceSelected; - _currentTrackPrice = MONEY32_UNDEFINED; + _currentTrackPrice = MONEY64_UNDEFINED; WindowRideConstructionUpdateActiveElements(); break; } @@ -1226,7 +1226,7 @@ public: { _currentTrackCurve = TrackElemType::RightQuarterBankedHelixLargeUp | RideConstructionSpecialPieceSelected; - _currentTrackPrice = MONEY32_UNDEFINED; + _currentTrackPrice = MONEY64_UNDEFINED; WindowRideConstructionUpdateActiveElements(); break; } @@ -1238,14 +1238,14 @@ public: if (_currentTrackCurve == TRACK_CURVE_LEFT) { _currentTrackCurve = TrackElemType::LeftQuarterHelixLargeUp | RideConstructionSpecialPieceSelected; - _currentTrackPrice = MONEY32_UNDEFINED; + _currentTrackPrice = MONEY64_UNDEFINED; WindowRideConstructionUpdateActiveElements(); break; } if (_currentTrackCurve == TRACK_CURVE_RIGHT) { _currentTrackCurve = TrackElemType::RightQuarterHelixLargeUp | RideConstructionSpecialPieceSelected; - _currentTrackPrice = MONEY32_UNDEFINED; + _currentTrackPrice = MONEY64_UNDEFINED; WindowRideConstructionUpdateActiveElements(); break; } @@ -1265,7 +1265,7 @@ public: _currentTrackLiftHill ^= CONSTRUCTION_LIFT_HILL_SELECTED; if ((_currentTrackLiftHill & CONSTRUCTION_LIFT_HILL_SELECTED) && !gCheatsEnableChainLiftOnAllTrack) _currentTrackAlternative &= ~RIDE_TYPE_ALTERNATIVE_TRACK_PIECES; - _currentTrackPrice = MONEY32_UNDEFINED; + _currentTrackPrice = MONEY64_UNDEFINED; WindowRideConstructionUpdateActiveElements(); break; case WIDX_BANK_LEFT: @@ -1273,7 +1273,7 @@ public: if (!_currentlyShowingBrakeOrBoosterSpeed) { _currentTrackBankEnd = TRACK_BANK_LEFT; - _currentTrackPrice = MONEY32_UNDEFINED; + _currentTrackPrice = MONEY64_UNDEFINED; WindowRideConstructionUpdateActiveElements(); } break; @@ -1282,7 +1282,7 @@ public: if (!_currentlyShowingBrakeOrBoosterSpeed) { _currentTrackBankEnd = TRACK_BANK_NONE; - _currentTrackPrice = MONEY32_UNDEFINED; + _currentTrackPrice = MONEY64_UNDEFINED; WindowRideConstructionUpdateActiveElements(); } else @@ -1309,7 +1309,7 @@ public: if (!_currentlyShowingBrakeOrBoosterSpeed) { _currentTrackBankEnd = TRACK_BANK_RIGHT; - _currentTrackPrice = MONEY32_UNDEFINED; + _currentTrackPrice = MONEY64_UNDEFINED; WindowRideConstructionUpdateActiveElements(); } else @@ -1336,7 +1336,7 @@ public: case WIDX_U_TRACK: RideConstructionInvalidateCurrentTrack(); _currentTrackAlternative &= ~RIDE_TYPE_ALTERNATIVE_TRACK_PIECES; - _currentTrackPrice = MONEY32_UNDEFINED; + _currentTrackPrice = MONEY64_UNDEFINED; WindowRideConstructionUpdateActiveElements(); break; case WIDX_O_TRACK: @@ -1344,7 +1344,7 @@ public: _currentTrackAlternative |= RIDE_TYPE_ALTERNATIVE_TRACK_PIECES; if (!gCheatsEnableChainLiftOnAllTrack) _currentTrackLiftHill &= ~CONSTRUCTION_LIFT_HILL_SELECTED; - _currentTrackPrice = MONEY32_UNDEFINED; + _currentTrackPrice = MONEY64_UNDEFINED; WindowRideConstructionUpdateActiveElements(); break; case WIDX_SEAT_ROTATION_ANGLE_SPINNER_UP: @@ -1386,7 +1386,7 @@ public: return; RideConstructionInvalidateCurrentTrack(); - _currentTrackPrice = MONEY32_UNDEFINED; + _currentTrackPrice = MONEY64_UNDEFINED; track_type_t trackPiece = _currentPossibleRideConfigurations[selectedIndex]; switch (trackPiece) { @@ -1523,7 +1523,7 @@ public: DrawTextBasic(dpi, screenCoords, STR_BUILD_THIS, {}, { TextAlignment::CENTRE }); screenCoords.y += 11; - if (_currentTrackPrice != MONEY32_UNDEFINED && !(gParkFlags & PARK_FLAGS_NO_MONEY)) + if (_currentTrackPrice != MONEY64_UNDEFINED && !(gParkFlags & PARK_FLAGS_NO_MONEY)) { auto ft = Formatter(); ft.Add(_currentTrackPrice); @@ -2251,8 +2251,8 @@ private: int32_t trackType, trackDirection, liftHillAndAlternativeState, properties; CoordsXYZ trackPos{}; - _currentTrackPrice = MONEY32_UNDEFINED; - _trackPlaceCost = MONEY32_UNDEFINED; + _currentTrackPrice = MONEY64_UNDEFINED; + _trackPlaceCost = MONEY64_UNDEFINED; _trackPlaceErrorMessage = STR_NONE; RideConstructionInvalidateCurrentTrack(); if (WindowRideConstructionUpdateState( @@ -2283,7 +2283,7 @@ private: // Used by some functions if (res.Error != GameActions::Status::Ok) { - _trackPlaceCost = MONEY32_UNDEFINED; + _trackPlaceCost = MONEY64_UNDEFINED; _trackPlaceErrorMessage = std::get(res.ErrorMessage); } else @@ -2324,7 +2324,7 @@ private: CoordsXYE inputElement, outputElement; TrackBeginEnd trackBeginEnd; - _currentTrackPrice = MONEY32_UNDEFINED; + _currentTrackPrice = MONEY64_UNDEFINED; RideConstructionInvalidateCurrentTrack(); // Select the track element that is to be deleted @@ -2433,7 +2433,7 @@ private: _autoRotatingShop = false; _currentTrackPieceDirection = (_currentTrackPieceDirection + 1) & 3; RideConstructionInvalidateCurrentTrack(); - _currentTrackPrice = MONEY32_UNDEFINED; + _currentTrackPrice = MONEY64_UNDEFINED; WindowRideConstructionUpdateActiveElements(); } @@ -2492,7 +2492,7 @@ private: void UpdateLiftHillSelected(int32_t slope) { _currentTrackSlopeEnd = slope; - _currentTrackPrice = MONEY32_UNDEFINED; + _currentTrackPrice = MONEY64_UNDEFINED; if (_rideConstructionState == RideConstructionState::Front && !gCheatsEnableChainLiftOnAllTrack) { switch (slope) @@ -3354,7 +3354,7 @@ void RideConstructionToolupdateConstruct(const ScreenCoordsXY& screenCoords) &trackType, &trackDirection, &rideIndex, &liftHillAndAlternativeState, &trackPos, nullptr); _currentTrackPrice = PlaceProvisionalTrackPiece( rideIndex, trackType, trackDirection, liftHillAndAlternativeState, trackPos); - if (_currentTrackPrice != MONEY32_UNDEFINED) + if (_currentTrackPrice != MONEY64_UNDEFINED) break; _currentTrackBegin.z -= 8; @@ -3379,7 +3379,7 @@ void RideConstructionToolupdateConstruct(const ScreenCoordsXY& screenCoords) rideIndex, trackType, trackDirection, liftHillAndAlternativeState, trackPos); mapCoords = trackPos; z = trackPos.z; - if (_currentTrackPrice != MONEY32_UNDEFINED) + if (_currentTrackPrice != MONEY64_UNDEFINED) break; _currentTrackBegin.z -= 8; @@ -3611,7 +3611,7 @@ void RideConstructionTooldownConstruct(const ScreenCoordsXY& screenCoords) } else { - _trackPlaceCost = MONEY32_UNDEFINED; + _trackPlaceCost = MONEY64_UNDEFINED; _trackPlaceErrorMessage = std::get(mazeSetTrackResult.ErrorMessage); } @@ -3668,7 +3668,7 @@ void RideConstructionTooldownConstruct(const ScreenCoordsXY& screenCoords) WindowEventMouseUpCall(w, WIDX_CONSTRUCT); gDisableErrorWindowSound = false; - if (_trackPlaceCost == MONEY32_UNDEFINED) + if (_trackPlaceCost == MONEY64_UNDEFINED) { StringId errorText = _trackPlaceErrorMessage; z -= 8; diff --git a/src/openrct2-ui/windows/RideList.cpp b/src/openrct2-ui/windows/RideList.cpp index b3c96811c9..5e220cbf07 100644 --- a/src/openrct2-ui/windows/RideList.cpp +++ b/src/openrct2-ui/windows/RideList.cpp @@ -636,7 +636,7 @@ public: break; case INFORMATION_TYPE_RUNNING_COST: formatSecondary = STR_RIDE_LIST_RUNNING_COST_UNKNOWN; - if (ridePtr->upkeep_cost != MONEY16_UNDEFINED) + if (ridePtr->upkeep_cost != MONEY64_UNDEFINED) { formatSecondary = STR_RIDE_LIST_RUNNING_COST_LABEL; ft.Add(ridePtr->upkeep_cost * 16); diff --git a/src/openrct2-ui/windows/Scenery.cpp b/src/openrct2-ui/windows/Scenery.cpp index 77846a5155..c0de26e1b7 100644 --- a/src/openrct2-ui/windows/Scenery.cpp +++ b/src/openrct2-ui/windows/Scenery.cpp @@ -192,7 +192,7 @@ public: _selectedScenery = {}; _hoverCounter = 0; gSceneryGhostType = 0; - gSceneryPlaceCost = MONEY32_UNDEFINED; + gSceneryPlaceCost = MONEY64_UNDEFINED; gSceneryPlaceRotation = 0; gWindowSceneryPaintEnabled = 0; // repaint coloured scenery tool state gWindowSceneryEyedropperEnabled = false; @@ -338,7 +338,7 @@ public: { _activeTabIndex = widgetIndex - WIDX_SCENERY_TAB_1; Invalidate(); - gSceneryPlaceCost = MONEY32_UNDEFINED; + gSceneryPlaceCost = MONEY64_UNDEFINED; ContentUpdateScroll(); } @@ -776,7 +776,7 @@ public: } auto [name, price] = GetNameAndPrice(selectedSceneryEntry); - if (price != MONEY32_UNDEFINED && !(gParkFlags & PARK_FLAGS_NO_MONEY)) + if (price != MONEY64_UNDEFINED && !(gParkFlags & PARK_FLAGS_NO_MONEY)) { auto ft = Formatter(); ft.Add(price); @@ -830,7 +830,7 @@ public: gWindowSceneryEyedropperEnabled = false; OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::Click1, 0, ContextGetWidth() / 2); _hoverCounter = -16; - gSceneryPlaceCost = MONEY32_UNDEFINED; + gSceneryPlaceCost = MONEY64_UNDEFINED; Invalidate(); } @@ -1362,7 +1362,7 @@ private: gWindowSceneryEyedropperEnabled = false; OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::Click1, 0, windowPos.x + (width / 2)); _hoverCounter = -16; - gSceneryPlaceCost = MONEY32_UNDEFINED; + gSceneryPlaceCost = MONEY64_UNDEFINED; Invalidate(); } @@ -1376,11 +1376,11 @@ private: } } - std::pair GetNameAndPrice(ScenerySelection selectedScenery) + std::pair GetNameAndPrice(ScenerySelection selectedScenery) { StringId name = STR_UNKNOWN_OBJECT_TYPE; - money32 price = MONEY32_UNDEFINED; - if (selectedScenery.IsUndefined() && gSceneryPlaceCost != MONEY32_UNDEFINED) + money64 price = MONEY64_UNDEFINED; + if (selectedScenery.IsUndefined() && gSceneryPlaceCost != MONEY64_UNDEFINED) { price = gSceneryPlaceCost; } diff --git a/src/openrct2-ui/windows/TrackDesignPlace.cpp b/src/openrct2-ui/windows/TrackDesignPlace.cpp index 5ea86faf2a..0763bb6e3c 100644 --- a/src/openrct2-ui/windows/TrackDesignPlace.cpp +++ b/src/openrct2-ui/windows/TrackDesignPlace.cpp @@ -84,7 +84,7 @@ public: WindowPushOthersRight(*this); ShowGridlines(); _miniPreview.resize(TRACK_MINI_PREVIEW_SIZE); - _placementCost = MONEY32_UNDEFINED; + _placementCost = MONEY64_UNDEFINED; _placementLoc.SetNull(); _currentTrackPieceDirection = (2 - GetCurrentRotation()) & 3; } @@ -167,7 +167,7 @@ public: return; } - money32 cost = MONEY32_UNDEFINED; + money64 cost = MONEY64_UNDEFINED; // Get base Z position mapZ = GetBaseZ(mapCoords); @@ -192,7 +192,7 @@ public: } }); res = GameActions::Execute(&tdAction); - cost = res.Error == GameActions::Status::Ok ? res.Cost : MONEY32_UNDEFINED; + cost = res.Error == GameActions::Status::Ok ? res.Cost : MONEY64_UNDEFINED; } } @@ -304,7 +304,7 @@ public: } // Price - if (_placementCost != MONEY32_UNDEFINED && !(gParkFlags & PARK_FLAGS_NO_MONEY)) + if (_placementCost != MONEY64_UNDEFINED && !(gParkFlags & PARK_FLAGS_NO_MONEY)) { ft = Formatter(); ft.Add(_placementCost); @@ -383,7 +383,7 @@ private: CoordsXY _placementLoc; RideId _placementGhostRideId; bool _hasPlacementGhost; - money32 _placementCost; + money64 _placementCost; CoordsXYZD _placementGhostLoc; std::vector _miniPreview; diff --git a/src/openrct2/Editor.cpp b/src/openrct2/Editor.cpp index fe623cf43f..734ac5914f 100644 --- a/src/openrct2/Editor.cpp +++ b/src/openrct2/Editor.cpp @@ -330,8 +330,7 @@ namespace Editor gParkFlags &= ~PARK_FLAGS_SPRITES_INITIALISED; - gGuestInitialCash = std::clamp( - gGuestInitialCash, static_cast(10.00_GBP), static_cast(MAX_ENTRANCE_FEE)); + gGuestInitialCash = std::clamp(gGuestInitialCash, 10.00_GBP, MAX_ENTRANCE_FEE); gInitialCash = std::min(gInitialCash, 100000); FinanceResetCashToInitial(); diff --git a/src/openrct2/actions/ClearAction.cpp b/src/openrct2/actions/ClearAction.cpp index a5e0724517..a3d4110801 100644 --- a/src/openrct2/actions/ClearAction.cpp +++ b/src/openrct2/actions/ClearAction.cpp @@ -78,7 +78,7 @@ GameActions::Result ClearAction::QueryExecute(bool executing) const auto noValidTiles = true; auto error = GameActions::Status::Ok; StringId errorMessage = STR_NONE; - money32 totalCost = 0; + money64 totalCost = 0; auto validRange = ClampRangeWithinMap(_range); for (int32_t y = validRange.GetTop(); y <= validRange.GetBottom(); y += COORDS_XY_STEP) @@ -88,7 +88,7 @@ GameActions::Result ClearAction::QueryExecute(bool executing) const if (LocationValid({ x, y }) && MapCanClearAt({ x, y })) { auto cost = ClearSceneryFromTile({ x, y }, executing); - if (cost != MONEY32_UNDEFINED) + if (cost != MONEY64_UNDEFINED) { noValidTiles = false; totalCost += cost; @@ -117,11 +117,11 @@ GameActions::Result ClearAction::QueryExecute(bool executing) const return result; } -money32 ClearAction::ClearSceneryFromTile(const CoordsXY& tilePos, bool executing) const +money64 ClearAction::ClearSceneryFromTile(const CoordsXY& tilePos, bool executing) const { // Pass down all flags. TileElement* tileElement = nullptr; - money32 totalCost = 0; + money64 totalCost = 0; bool tileEdited; do { diff --git a/src/openrct2/actions/ClearAction.h b/src/openrct2/actions/ClearAction.h index d07034c6aa..8110b94040 100644 --- a/src/openrct2/actions/ClearAction.h +++ b/src/openrct2/actions/ClearAction.h @@ -45,7 +45,7 @@ public: private: GameActions::Result CreateResult() const; GameActions::Result QueryExecute(bool executing) const; - money32 ClearSceneryFromTile(const CoordsXY& tilePos, bool executing) const; + money64 ClearSceneryFromTile(const CoordsXY& tilePos, bool executing) const; /** * Function to clear the flag that is set to prevent cost duplication diff --git a/src/openrct2/actions/FootpathRemoveAction.cpp b/src/openrct2/actions/FootpathRemoveAction.cpp index e18b4b0c38..bb8cada8eb 100644 --- a/src/openrct2/actions/FootpathRemoveAction.cpp +++ b/src/openrct2/actions/FootpathRemoveAction.cpp @@ -150,9 +150,9 @@ TileElement* FootpathRemoveAction::GetFootpathElement() const return footpathElement; } -money32 FootpathRemoveAction::GetRefundPrice(TileElement* footpathElement) const +money64 FootpathRemoveAction::GetRefundPrice(TileElement* footpathElement) const { - money32 cost = -10.00_GBP; + money64 cost = -10.00_GBP; return cost; } diff --git a/src/openrct2/actions/FootpathRemoveAction.h b/src/openrct2/actions/FootpathRemoveAction.h index f2a27cb21e..56a992e470 100644 --- a/src/openrct2/actions/FootpathRemoveAction.h +++ b/src/openrct2/actions/FootpathRemoveAction.h @@ -31,6 +31,6 @@ public: private: TileElement* GetFootpathElement() const; - money32 GetRefundPrice(TileElement* footpathElement) const; + money64 GetRefundPrice(TileElement* footpathElement) const; GameActions::Result RemoveBannersAtElement(const CoordsXY& loc, TileElement* tileElement) const; }; diff --git a/src/openrct2/actions/GameActionResult.h b/src/openrct2/actions/GameActionResult.h index df4551a3a9..ae64d34eda 100644 --- a/src/openrct2/actions/GameActionResult.h +++ b/src/openrct2/actions/GameActionResult.h @@ -68,7 +68,7 @@ namespace GameActions StringVariant ErrorMessage = STR_NONE; std::array ErrorMessageArgs{}; CoordsXYZ Position = { LOCATION_NULL, LOCATION_NULL, LOCATION_NULL }; - money32 Cost = 0; + money64 Cost = 0; ExpenditureType Expenditure = ExpenditureType::Count; #ifdef __ANDROID__ diff --git a/src/openrct2/actions/LandSetHeightAction.cpp b/src/openrct2/actions/LandSetHeightAction.cpp index a41bb81cd0..54f79054a2 100644 --- a/src/openrct2/actions/LandSetHeightAction.cpp +++ b/src/openrct2/actions/LandSetHeightAction.cpp @@ -73,7 +73,7 @@ GameActions::Result LandSetHeightAction::Query() const } } - money32 sceneryRemovalCost = 0; + money64 sceneryRemovalCost = 0; if (!gCheatsDisableClearanceChecks) { if (gParkFlags & PARK_FLAGS_FORBID_TREE_REMOVAL) @@ -150,7 +150,7 @@ GameActions::Result LandSetHeightAction::Query() const GameActions::Result LandSetHeightAction::Execute() const { - money32 cost = 0.00_GBP; + money64 cost = 0.00_GBP; auto surfaceHeight = TileElementHeight(_coords); FootpathRemoveLitter({ _coords, surfaceHeight }); @@ -230,9 +230,9 @@ TileElement* LandSetHeightAction::CheckTreeObstructions() const return nullptr; } -money32 LandSetHeightAction::GetSmallSceneryRemovalCost() const +money64 LandSetHeightAction::GetSmallSceneryRemovalCost() const { - money32 cost{ 0 }; + money64 cost{ 0 }; for (auto* sceneryElement : TileElementsView(_coords)) { @@ -321,9 +321,9 @@ TileElement* LandSetHeightAction::CheckFloatingStructures(TileElement* surfaceEl return nullptr; } -money32 LandSetHeightAction::GetSurfaceHeightChangeCost(SurfaceElement* surfaceElement) const +money64 LandSetHeightAction::GetSurfaceHeightChangeCost(SurfaceElement* surfaceElement) const { - money32 cost{ 0 }; + money64 cost{ 0 }; for (Direction i : ALL_DIRECTIONS) { int32_t cornerHeight = TileElementGetCornerHeight(surfaceElement, i); @@ -349,7 +349,7 @@ void LandSetHeightAction::SetSurfaceHeight(TileElement* surfaceElement) const int32_t LandSetHeightAction::MapSetLandHeightClearFunc( TileElement** tile_element, [[maybe_unused]] const CoordsXY& coords, [[maybe_unused]] uint8_t flags, - [[maybe_unused]] money32* price) + [[maybe_unused]] money64* price) { if ((*tile_element)->GetType() == TileElementType::Surface) return 0; diff --git a/src/openrct2/actions/LandSetHeightAction.h b/src/openrct2/actions/LandSetHeightAction.h index 78913f2303..99cf9e8da7 100644 --- a/src/openrct2/actions/LandSetHeightAction.h +++ b/src/openrct2/actions/LandSetHeightAction.h @@ -33,11 +33,11 @@ public: private: StringId CheckParameters() const; TileElement* CheckTreeObstructions() const; - money32 GetSmallSceneryRemovalCost() const; + money64 GetSmallSceneryRemovalCost() const; void SmallSceneryRemoval() const; StringId CheckRideSupports() const; TileElement* CheckFloatingStructures(TileElement* surfaceElement, uint8_t zCorner) const; - money32 GetSurfaceHeightChangeCost(SurfaceElement* surfaceElement) const; + money64 GetSurfaceHeightChangeCost(SurfaceElement* surfaceElement) const; void SetSurfaceHeight(TileElement* surfaceElement) const; /** @@ -46,5 +46,5 @@ private: */ static int32_t MapSetLandHeightClearFunc( TileElement** tile_element, [[maybe_unused]] const CoordsXY& coords, [[maybe_unused]] uint8_t flags, - [[maybe_unused]] money32* price); + [[maybe_unused]] money64* price); }; diff --git a/src/openrct2/actions/LandSmoothAction.cpp b/src/openrct2/actions/LandSmoothAction.cpp index e117f8d986..bc14870ff5 100644 --- a/src/openrct2/actions/LandSmoothAction.cpp +++ b/src/openrct2/actions/LandSmoothAction.cpp @@ -94,13 +94,13 @@ GameActions::Result LandSmoothAction::SmoothLandTile( return res; } -money32 LandSmoothAction::SmoothLandRowByEdge( +money64 LandSmoothAction::SmoothLandRowByEdge( bool isExecuting, const CoordsXY& loc, int32_t expectedLandHeight1, int32_t expectedLandHeight2, int32_t stepX, int32_t stepY, int32_t direction1, int32_t direction2, int32_t checkDirection1, int32_t checkDirection2) const { uint8_t shouldContinue = 0xF; int32_t landChangePerTile = _isLowering ? 2 : -2; - money32 totalCost = 0; + money64 totalCost = 0; // check if we need to start at all if (!LocationValid(loc) || !LocationValid({ loc.x + stepX, loc.y + stepY })) @@ -238,12 +238,12 @@ money32 LandSmoothAction::SmoothLandRowByEdge( return totalCost; } -money32 LandSmoothAction::SmoothLandRowByCorner( +money64 LandSmoothAction::SmoothLandRowByCorner( bool isExecuting, const CoordsXY& loc, int32_t expectedLandHeight, int32_t stepX, int32_t stepY, int32_t direction, int32_t checkDirection) const { bool shouldContinue = true; - money32 totalCost = 0; + money64 totalCost = 0; int32_t landChangePerTile; if (stepX == 0 || stepY == 0) { diff --git a/src/openrct2/actions/LandSmoothAction.h b/src/openrct2/actions/LandSmoothAction.h index 8961590e66..bd2787c6f7 100644 --- a/src/openrct2/actions/LandSmoothAction.h +++ b/src/openrct2/actions/LandSmoothAction.h @@ -39,10 +39,10 @@ public: private: GameActions::Result SmoothLandTile( int32_t direction, bool isExecuting, const CoordsXY& loc, SurfaceElement* surfaceElement) const; - money32 SmoothLandRowByEdge( + money64 SmoothLandRowByEdge( bool isExecuting, const CoordsXY& loc, int32_t expectedLandHeight1, int32_t expectedLandHeight2, int32_t stepX, int32_t stepY, int32_t direction1, int32_t direction2, int32_t checkDirection1, int32_t checkDirection2) const; - money32 SmoothLandRowByCorner( + money64 SmoothLandRowByCorner( bool isExecuting, const CoordsXY& loc, int32_t expectedLandHeight, int32_t stepX, int32_t stepY, int32_t direction, int32_t checkDirection) const; GameActions::Result SmoothLand(bool isExecuting) const; diff --git a/src/openrct2/actions/LargeSceneryPlaceAction.cpp b/src/openrct2/actions/LargeSceneryPlaceAction.cpp index 4d6dd9dc3e..f20732993d 100644 --- a/src/openrct2/actions/LargeSceneryPlaceAction.cpp +++ b/src/openrct2/actions/LargeSceneryPlaceAction.cpp @@ -65,7 +65,7 @@ GameActions::Result LargeSceneryPlaceAction::Query() const auto resultData = LargeSceneryPlaceActionResult{}; - money32 supportsCost = 0; + money64 supportsCost = 0; if (_primaryColour >= COLOUR_COUNT || _secondaryColour >= COLOUR_COUNT || _tertiaryColour >= COLOUR_COUNT) { @@ -191,7 +191,7 @@ GameActions::Result LargeSceneryPlaceAction::Execute() const auto resultData = LargeSceneryPlaceActionResult{}; - money32 supportsCost = 0; + money64 supportsCost = 0; auto* sceneryEntry = OpenRCT2::ObjectManager::GetObjectEntry(_sceneryType); if (sceneryEntry == nullptr) diff --git a/src/openrct2/actions/ParkMarketingAction.cpp b/src/openrct2/actions/ParkMarketingAction.cpp index 9847a26f9f..3d0cda0b99 100644 --- a/src/openrct2/actions/ParkMarketingAction.cpp +++ b/src/openrct2/actions/ParkMarketingAction.cpp @@ -94,7 +94,7 @@ GameActions::Result ParkMarketingAction::CreateResult() const return result; } -money32 ParkMarketingAction::CalculatePrice() const +money64 ParkMarketingAction::CalculatePrice() const { return _numWeeks * AdvertisingCampaignPricePerWeek[_type]; } diff --git a/src/openrct2/actions/ParkMarketingAction.h b/src/openrct2/actions/ParkMarketingAction.h index a85dd9950d..9b0b4cbb05 100644 --- a/src/openrct2/actions/ParkMarketingAction.h +++ b/src/openrct2/actions/ParkMarketingAction.h @@ -32,5 +32,5 @@ public: private: GameActions::Result CreateResult() const; - money32 CalculatePrice() const; + money64 CalculatePrice() const; }; diff --git a/src/openrct2/actions/ParkSetEntranceFeeAction.cpp b/src/openrct2/actions/ParkSetEntranceFeeAction.cpp index 4af6160ecb..7fe95f73c3 100644 --- a/src/openrct2/actions/ParkSetEntranceFeeAction.cpp +++ b/src/openrct2/actions/ParkSetEntranceFeeAction.cpp @@ -15,7 +15,7 @@ #include "../localisation/StringIds.h" #include "../world/Park.h" -ParkSetEntranceFeeAction::ParkSetEntranceFeeAction(money16 fee) +ParkSetEntranceFeeAction::ParkSetEntranceFeeAction(money64 fee) : _fee(fee) { } diff --git a/src/openrct2/actions/ParkSetEntranceFeeAction.h b/src/openrct2/actions/ParkSetEntranceFeeAction.h index 8e25d345d2..a929913b2b 100644 --- a/src/openrct2/actions/ParkSetEntranceFeeAction.h +++ b/src/openrct2/actions/ParkSetEntranceFeeAction.h @@ -14,11 +14,11 @@ class ParkSetEntranceFeeAction final : public GameActionBase { private: - money16 _fee{ MONEY16_UNDEFINED }; + money64 _fee{ MONEY64_UNDEFINED }; public: ParkSetEntranceFeeAction() = default; - ParkSetEntranceFeeAction(money16 fee); + ParkSetEntranceFeeAction(money64 fee); void AcceptParameters(GameActionParameterVisitor& visitor) override; diff --git a/src/openrct2/actions/RideCreateAction.cpp b/src/openrct2/actions/RideCreateAction.cpp index 938bc885a2..0d70ab429b 100644 --- a/src/openrct2/actions/RideCreateAction.cpp +++ b/src/openrct2/actions/RideCreateAction.cpp @@ -238,10 +238,10 @@ GameActions::Result RideCreateAction::Execute() const { if (ShopItemHasCommonPrice(ShopItem::Admission)) { - money32 price = RideGetCommonPrice(*ride); - if (price != MONEY32_UNDEFINED) + auto price = RideGetCommonPrice(*ride); + if (price != MONEY64_UNDEFINED) { - ride->price[0] = static_cast(price); + ride->price[0] = price; } } } @@ -252,10 +252,10 @@ GameActions::Result RideCreateAction::Execute() const { if (ShopItemHasCommonPrice(rideEntry->shop_item[i])) { - money32 price = ShopItemGetCommonPrice(ride, rideEntry->shop_item[i]); - if (price != MONEY32_UNDEFINED) + auto price = ShopItemGetCommonPrice(ride, rideEntry->shop_item[i]); + if (price != MONEY64_UNDEFINED) { - ride->price[i] = static_cast(price); + ride->price[i] = price; } } } @@ -264,10 +264,10 @@ GameActions::Result RideCreateAction::Execute() const // Set the on-ride photo price, whether the ride has one or not (except shops). if (!rtd.HasFlag(RIDE_TYPE_FLAG_IS_SHOP_OR_FACILITY) && ShopItemHasCommonPrice(ShopItem::Photo)) { - money32 price = ShopItemGetCommonPrice(ride, ShopItem::Photo); - if (price != MONEY32_UNDEFINED) + auto price = ShopItemGetCommonPrice(ride, ShopItem::Photo); + if (price != MONEY64_UNDEFINED) { - ride->price[1] = static_cast(price); + ride->price[1] = price; } } } @@ -290,7 +290,7 @@ GameActions::Result RideCreateAction::Execute() const ride->music_tune_id = TUNE_ID_NULL; ride->breakdown_reason = 255; - ride->upkeep_cost = MONEY16_UNDEFINED; + ride->upkeep_cost = MONEY64_UNDEFINED; ride->reliability = RIDE_INITIAL_RELIABILITY; ride->unreliability_factor = 1; ride->inspection_interval = RIDE_INSPECTION_EVERY_30_MINUTES; diff --git a/src/openrct2/actions/RideDemolishAction.cpp b/src/openrct2/actions/RideDemolishAction.cpp index bf03ba1d02..244c66a352 100644 --- a/src/openrct2/actions/RideDemolishAction.cpp +++ b/src/openrct2/actions/RideDemolishAction.cpp @@ -121,7 +121,7 @@ GameActions::Result RideDemolishAction::Execute() const GameActions::Result RideDemolishAction::DemolishRide(Ride& ride) const { - money32 refundPrice = DemolishTracks(); + money64 refundPrice = DemolishTracks(); RideClearForConstruction(ride); ride.RemovePeeps(); @@ -174,7 +174,7 @@ GameActions::Result RideDemolishAction::DemolishRide(Ride& ride) const return res; } -money32 RideDemolishAction::MazeRemoveTrack(const CoordsXYZD& coords) const +money64 RideDemolishAction::MazeRemoveTrack(const CoordsXYZD& coords) const { auto setMazeTrack = MazeSetTrackAction(coords, false, _rideIndex, GC_SET_MAZE_TRACK_FILL); setMazeTrack.SetFlags(GetFlags()); @@ -185,12 +185,12 @@ money32 RideDemolishAction::MazeRemoveTrack(const CoordsXYZD& coords) const return execRes.Cost; } - return MONEY32_UNDEFINED; + return MONEY64_UNDEFINED; } -money32 RideDemolishAction::DemolishTracks() const +money64 RideDemolishAction::DemolishTracks() const { - money32 refundPrice = 0; + money64 refundPrice = 0; uint8_t oldpaused = gGamePaused; gGamePaused = 0; @@ -247,8 +247,8 @@ money32 RideDemolishAction::DemolishTracks() const for (Direction dir : ALL_DIRECTIONS) { const CoordsXYZ off = { DirOffsets[dir], 0 }; - money32 removePrice = MazeRemoveTrack({ location + off, dir }); - if (removePrice != MONEY32_UNDEFINED) + money64 removePrice = MazeRemoveTrack({ location + off, dir }); + if (removePrice != MONEY64_UNDEFINED) { refundPrice += removePrice; } @@ -289,12 +289,12 @@ GameActions::Result RideDemolishAction::RefurbishRide(Ride& ride) const return res; } -money32 RideDemolishAction::GetRefurbishPrice(const Ride& ride) const +money64 RideDemolishAction::GetRefurbishPrice(const Ride& ride) const { return -GetRefundPrice(ride) / 2; } -money32 RideDemolishAction::GetRefundPrice(const Ride& ride) const +money64 RideDemolishAction::GetRefundPrice(const Ride& ride) const { return RideGetRefundPrice(ride); } diff --git a/src/openrct2/actions/RideDemolishAction.h b/src/openrct2/actions/RideDemolishAction.h index 4e31c75011..881e00439a 100644 --- a/src/openrct2/actions/RideDemolishAction.h +++ b/src/openrct2/actions/RideDemolishAction.h @@ -31,9 +31,9 @@ public: private: GameActions::Result DemolishRide(Ride& ride) const; - money32 MazeRemoveTrack(const CoordsXYZD& coords) const; - money32 DemolishTracks() const; + money64 MazeRemoveTrack(const CoordsXYZD& coords) const; + money64 DemolishTracks() const; GameActions::Result RefurbishRide(Ride& ride) const; - money32 GetRefurbishPrice(const Ride& ride) const; - money32 GetRefundPrice(const Ride& ride) const; + money64 GetRefurbishPrice(const Ride& ride) const; + money64 GetRefundPrice(const Ride& ride) const; }; diff --git a/src/openrct2/actions/RideSetPriceAction.cpp b/src/openrct2/actions/RideSetPriceAction.cpp index 261056a67d..cf365e968c 100644 --- a/src/openrct2/actions/RideSetPriceAction.cpp +++ b/src/openrct2/actions/RideSetPriceAction.cpp @@ -21,7 +21,7 @@ #include "../ride/ShopItem.h" #include "../world/Park.h" -RideSetPriceAction::RideSetPriceAction(RideId rideIndex, money16 price, bool primaryPrice) +RideSetPriceAction::RideSetPriceAction(RideId rideIndex, money64 price, bool primaryPrice) : _rideIndex(rideIndex) , _price(price) , _primaryPrice(primaryPrice) diff --git a/src/openrct2/actions/RideSetPriceAction.h b/src/openrct2/actions/RideSetPriceAction.h index 052772ecf5..bacc67e43a 100644 --- a/src/openrct2/actions/RideSetPriceAction.h +++ b/src/openrct2/actions/RideSetPriceAction.h @@ -15,12 +15,12 @@ class RideSetPriceAction final : public GameActionBase(_value, 5.00_GBP, 200.00_GBP); + gLandPrice = std::clamp(_value, 5.00_GBP, 200.00_GBP); break; case ScenarioSetSetting::CostToBuyConstructionRights: - gConstructionRightsPrice = std::clamp(_value, 5.00_GBP, 200.00_GBP); + gConstructionRightsPrice = std::clamp(_value, 5.00_GBP, 200.00_GBP); break; case ScenarioSetSetting::ParkChargeMethod: if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) @@ -190,7 +190,7 @@ GameActions::Result ScenarioSetSettingAction::Execute() const } break; case ScenarioSetSetting::ParkChargeEntryFee: - gParkEntranceFee = std::clamp(_value, 0.00_GBP, MAX_ENTRANCE_FEE); + gParkEntranceFee = std::clamp(_value, 0.00_GBP, MAX_ENTRANCE_FEE); WindowInvalidateByClass(WindowClass::ParkInformation); break; case ScenarioSetSetting::ForbidTreeRemoval: diff --git a/src/openrct2/actions/SurfaceSetStyleAction.cpp b/src/openrct2/actions/SurfaceSetStyleAction.cpp index 41d41f05ea..47e67d0a31 100644 --- a/src/openrct2/actions/SurfaceSetStyleAction.cpp +++ b/src/openrct2/actions/SurfaceSetStyleAction.cpp @@ -99,8 +99,8 @@ GameActions::Result SurfaceSetStyleAction::Query() const GameActions::Status::Disallowed, STR_CANT_CHANGE_LAND_TYPE, STR_FORBIDDEN_BY_THE_LOCAL_AUTHORITY); } - money32 surfaceCost = 0; - money32 edgeCost = 0; + money64 surfaceCost = 0; + money64 edgeCost = 0; for (CoordsXY coords = { validRange.GetLeft(), validRange.GetTop() }; coords.x <= validRange.GetRight(); coords.x += COORDS_XY_STEP) { @@ -167,8 +167,8 @@ GameActions::Result SurfaceSetStyleAction::Execute() const res.Position.y = yMid; res.Position.z = heightMid; - money32 surfaceCost = 0; - money32 edgeCost = 0; + money64 surfaceCost = 0; + money64 edgeCost = 0; for (CoordsXY coords = { validRange.GetLeft(), validRange.GetTop() }; coords.x <= validRange.GetRight(); coords.x += COORDS_XY_STEP) { diff --git a/src/openrct2/actions/TrackPlaceAction.cpp b/src/openrct2/actions/TrackPlaceAction.cpp index 8d6c1e2ae6..df2715671c 100644 --- a/src/openrct2/actions/TrackPlaceAction.cpp +++ b/src/openrct2/actions/TrackPlaceAction.cpp @@ -211,7 +211,7 @@ GameActions::Result TrackPlaceAction::Query() const trackBlock = ted.Block; auto clearanceHeight = rideEntry->Clearance; - money32 costs = 0; + money64 costs = 0; money64 supportCosts = 0; for (int32_t blockIndex = 0; trackBlock->index != 0xFF; trackBlock++, blockIndex++) { @@ -438,7 +438,7 @@ GameActions::Result TrackPlaceAction::Execute() const const auto& ted = GetTrackElementDescriptor(_trackType); const auto& wallEdges = ted.SequenceElementAllowedWallEdges; - money32 costs = 0; + money64 costs = 0; money64 supportCosts = 0; const PreviewTrack* trackBlock = ted.Block; auto clearanceHeight = rideEntry->Clearance; diff --git a/src/openrct2/common.h b/src/openrct2/common.h index e82af77f0e..04b51cc00f 100644 --- a/src/openrct2/common.h +++ b/src/openrct2/common.h @@ -77,7 +77,6 @@ using fixed32_2dp = int32_t; using fixed64_1dp = int64_t; // Money is stored as a multiple of 0.10. -using money8 = fixed8_1dp; using money16 = fixed16_1dp; using money32 = fixed32_1dp; using money64 = fixed64_1dp; @@ -112,6 +111,11 @@ constexpr money64 ToMoney64FromGBP(double money) noexcept #define MONEY32_UNDEFINED (static_cast(0x80000000)) #define MONEY64_UNDEFINED (static_cast(0x8000000000000000)) +constexpr money16 ToMoney16(money64 value) +{ + return value == MONEY64_UNDEFINED ? MONEY16_UNDEFINED : value; +} + constexpr money64 ToMoney64(money32 value) { return value == MONEY32_UNDEFINED ? MONEY64_UNDEFINED : value; diff --git a/src/openrct2/entity/Guest.cpp b/src/openrct2/entity/Guest.cpp index aafc2f649a..2819ffe99c 100644 --- a/src/openrct2/entity/Guest.cpp +++ b/src/openrct2/entity/Guest.cpp @@ -1466,9 +1466,9 @@ void Guest::CheckCantFindExit() * * rct2: 0x0069AF1E */ -bool Guest::DecideAndBuyItem(Ride& ride, ShopItem shopItem, money32 price) +bool Guest::DecideAndBuyItem(Ride& ride, ShopItem shopItem, money64 price) { - money32 itemValue; + money64 itemValue; bool hasVoucher = false; @@ -1564,7 +1564,7 @@ bool Guest::DecideAndBuyItem(Ride& ride, ShopItem shopItem, money32 price) if (Happiness >= 180) itemValue /= 2; } - if (itemValue > (static_cast(ScenarioRand() & 0x07))) + if (itemValue > (static_cast(ScenarioRand() & 0x07))) { // "I'm not paying that much for x" InsertNewThought(GetShopItemDescriptor(shopItem).TooMuchThought, ride.id); @@ -1575,11 +1575,11 @@ bool Guest::DecideAndBuyItem(Ride& ride, ShopItem shopItem, money32 price) else { itemValue -= price; - itemValue = std::max(8, itemValue); + itemValue = std::max(0.80_GBP, itemValue); if (!(gParkFlags & PARK_FLAGS_NO_MONEY)) { - if (itemValue >= static_cast(ScenarioRand() & 0x07)) + if (itemValue >= static_cast(ScenarioRand() & 0x07)) { // "This x is a really good value" InsertNewThought(GetShopItemDescriptor(shopItem).GoodValueThought, ride.id); @@ -1670,7 +1670,7 @@ bool Guest::DecideAndBuyItem(Ride& ride, ShopItem shopItem, money32 price) if (GetShopItemDescriptor(shopItem).IsSouvenir()) AmountOfSouvenirs++; - money16* expend_type = &PaidOnSouvenirs; + money64* expend_type = &PaidOnSouvenirs; ExpenditureType expenditure = ExpenditureType::ShopStock; if (GetShopItemDescriptor(shopItem).IsFood()) @@ -1985,7 +1985,7 @@ bool Guest::ShouldGoOnRide(Ride& ride, StationIndex entranceNum, bool atQueue, b // Assuming the queue conditions are met, peeps will always go on free transport rides. // Ride ratings, recent crashes and weather will all be ignored. - money16 ridePrice = RideGetPrice(ride); + auto ridePrice = RideGetPrice(ride); if (!ride.GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_TRANSPORT_RIDE) || ride.value == RIDE_VALUE_UNDEFINED || ridePrice != 0) { @@ -2141,10 +2141,10 @@ bool Guest::ShouldGoOnRide(Ride& ride, StationIndex entranceNum, bool atQueue, b } } - uint32_t value = ride.value; + money64 value = ride.value; // If the value of the ride hasn't yet been calculated, peeps will be willing to pay any amount for the ride. - if (value != 0xFFFF && !PeepHasVoucherForFreeRide(this, ride) && !(gParkFlags & PARK_FLAGS_NO_MONEY)) + if (value != RIDE_VALUE_UNDEFINED && !PeepHasVoucherForFreeRide(this, ride) && !(gParkFlags & PARK_FLAGS_NO_MONEY)) { // The amount peeps are willing to pay is decreased by 75% if they had to pay to enter the park. if (PeepFlags & PEEP_FLAGS_HAS_PAID_FOR_PARK_ENTRY) @@ -2152,7 +2152,7 @@ bool Guest::ShouldGoOnRide(Ride& ride, StationIndex entranceNum, bool atQueue, b // Peeps won't pay more than twice the value of the ride. ridePrice = RideGetPrice(ride); - if (ridePrice > static_cast(value * 2)) + if (ridePrice > (value * 2)) { if (peepAtRide) { @@ -2168,7 +2168,7 @@ bool Guest::ShouldGoOnRide(Ride& ride, StationIndex entranceNum, bool atQueue, b } // A ride is good value if the price is 50% or less of the ride value and the peep didn't pay to enter the park. - if (ridePrice <= static_cast(value / 2) && peepAtRide) + if (ridePrice <= (value / 2) && peepAtRide) { if (!(gParkFlags & PARK_FLAGS_NO_MONEY)) { @@ -2276,9 +2276,9 @@ bool Guest::ShouldGoToShop(Ride& ride, bool peepAtShop) } // Used when no logging to an expend type required -void Guest::SpendMoney(money32 amount, ExpenditureType expenditure) +void Guest::SpendMoney(money64 amount, ExpenditureType expenditure) { - money16 unused; + money64 unused; SpendMoney(unused, amount, expenditure); } @@ -2287,14 +2287,14 @@ void Guest::SpendMoney(money32 amount, ExpenditureType expenditure) * rct2: 0x0069926C * Expend type was previously an offset saved in 0x00F1AEC0 */ -void Guest::SpendMoney(money16& peep_expend_type, money32 amount, ExpenditureType expenditure) +void Guest::SpendMoney(money64& peep_expend_type, money64 amount, ExpenditureType expenditure) { assert(!(gParkFlags & PARK_FLAGS_NO_MONEY)); - CashInPocket = std::max(0, CashInPocket - amount); + CashInPocket = std::max(0.00_GBP, static_cast(CashInPocket) - amount); CashSpent += amount; - peep_expend_type += static_cast(amount); + peep_expend_type += amount; WindowInvalidateByNumber(WindowClass::Peep, Id); @@ -2606,7 +2606,7 @@ static void PeepUpdateRideAtEntranceTryLeave(Guest* peep) } } -static bool PeepCheckRidePriceAtEntrance(Guest* peep, const Ride& ride, money32 ridePrice) +static bool PeepCheckRidePriceAtEntrance(Guest* peep, const Ride& ride, money64 ridePrice) { if ((peep->HasItem(ShopItem::Voucher)) && peep->VoucherType == VOUCHER_TYPE_RIDE_FREE && peep->VoucherRideId == peep->CurrentRide) @@ -2632,10 +2632,10 @@ static bool PeepCheckRidePriceAtEntrance(Guest* peep, const Ride& ride, money32 return false; } - uint16_t value = ride.value; + auto value = ride.value; if (value != RIDE_VALUE_UNDEFINED) { - if (value * 2 < ridePrice) + if ((value * 2) < ridePrice) { peep->InsertNewThought(PeepThoughtType::BadValue, peep->CurrentRide); PeepUpdateRideAtEntranceTryLeave(peep); @@ -2716,7 +2716,7 @@ static int16_t PeepCalculateRideValueSatisfaction(Guest* peep, const Ride& ride) return -30; } - money16 ridePrice = RideGetPrice(ride); + auto ridePrice = RideGetPrice(ride); if (ride.value >= ridePrice) { return -5; @@ -3392,7 +3392,7 @@ void Guest::UpdateBuying() } if (ride_type->shop_item[1] != ShopItem::None) { - money16 price = ride->price[1]; + auto price = ride->price[1]; item_bought = DecideAndBuyItem(*ride, ride_type->shop_item[1], price); if (item_bought) @@ -3403,7 +3403,7 @@ void Guest::UpdateBuying() if (!item_bought && ride_type->shop_item[0] != ShopItem::None) { - money16 price = ride->price[0]; + auto price = ride->price[0]; item_bought = DecideAndBuyItem(*ride, ride_type->shop_item[0], price); if (item_bought) @@ -3487,7 +3487,7 @@ void Guest::UpdateRideAtEntrance() if (ride->lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN) return; - money16 ridePrice = RideGetPrice(*ride); + auto ridePrice = RideGetPrice(*ride); if (ridePrice != 0) { if (!PeepCheckRidePriceAtEntrance(this, *ride, ridePrice)) @@ -3819,7 +3819,7 @@ static void PeepGoToRideExit(Peep* peep, const Ride& ride, int16_t x, int16_t y, */ void Guest::UpdateRideFreeVehicleEnterRide(Ride& ride) { - money16 ridePrice = RideGetPrice(ride); + auto ridePrice = RideGetPrice(ride); if (ridePrice != 0) { if ((HasItem(ShopItem::Voucher)) && (VoucherType == VOUCHER_TYPE_RIDE_FREE) && (VoucherRideId == CurrentRide)) @@ -3829,7 +3829,7 @@ void Guest::UpdateRideFreeVehicleEnterRide(Ride& ride) } else { - ride.total_profit += ridePrice; + ride.total_profit = AddClamp_money64(ride.total_profit, ridePrice); ride.window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; SpendMoney(PaidOnRides, ridePrice, ExpenditureType::ParkRideTickets); } @@ -7130,11 +7130,11 @@ Guest* Guest::Generate(const CoordsXYZ& coords) peep->PeepId = gNextGuestNumber++; peep->Name = nullptr; - money32 cash = (ScenarioRand() & 0x3) * 100 - 100 + gGuestInitialCash; + money64 cash = (ScenarioRand() & 0x3) * 100 - 100 + gGuestInitialCash; if (cash < 0) cash = 0; - if (gGuestInitialCash == 0) + if (gGuestInitialCash == 0.00_GBP) { cash = 500; } @@ -7144,7 +7144,7 @@ Guest* Guest::Generate(const CoordsXYZ& coords) cash = 0; } - if (gGuestInitialCash == MONEY16_UNDEFINED) + if (gGuestInitialCash == MONEY64_UNDEFINED) { cash = 0; } diff --git a/src/openrct2/entity/Guest.h b/src/openrct2/entity/Guest.h index 3c7fd5708b..9fb234e310 100644 --- a/src/openrct2/entity/Guest.h +++ b/src/openrct2/entity/Guest.h @@ -267,11 +267,11 @@ public: RideId GuestHeadingToRideId; uint8_t GuestIsLostCountdown; uint8_t GuestTimeOnRide; - money16 PaidToEnter; - money16 PaidOnRides; - money16 PaidOnFood; - money16 PaidOnDrink; - money16 PaidOnSouvenirs; + money64 PaidToEnter; + money64 PaidOnRides; + money64 PaidOnFood; + money64 PaidOnDrink; + money64 PaidOnSouvenirs; bool OutsideOfPark; uint8_t Happiness; uint8_t HappinessTarget; @@ -284,8 +284,8 @@ public: IntensityRange Intensity{ 0 }; PeepNauseaTolerance NauseaTolerance; uint16_t TimeInQueue; - money32 CashInPocket; - money32 CashSpent; + money64 CashInPocket; + money64 CashSpent; RideId Photo1RideRef; RideId Photo2RideRef; RideId Photo3RideRef; @@ -342,8 +342,8 @@ public: bool ShouldFindBench(); bool UpdateWalkingFindBench(); bool UpdateWalkingFindBin(); - void SpendMoney(money16& peep_expend_type, money32 amount, ExpenditureType type); - void SpendMoney(money32 amount, ExpenditureType type); + void SpendMoney(money64& peep_expend_type, money64 amount, ExpenditureType type); + void SpendMoney(money64 amount, ExpenditureType type); void SetHasRidden(const Ride& ride); bool HasRidden(const Ride& ride) const; void SetHasRiddenRideType(int32_t rideType); @@ -353,7 +353,7 @@ public: void CheckIfLost(); void CheckCantFindRide(); void CheckCantFindExit(); - bool DecideAndBuyItem(Ride& ride, ShopItem shopItem, money32 price); + bool DecideAndBuyItem(Ride& ride, ShopItem shopItem, money64 price); void SetSpriteType(PeepSpriteType new_sprite_type); void HandleEasterEggName(); int32_t GetEasterEggNameId() const; @@ -465,7 +465,7 @@ extern uint32_t gNumGuestsInPark; extern uint32_t gNumGuestsInParkLastWeek; extern uint32_t gNumGuestsHeadingForPark; -extern money16 gGuestInitialCash; +extern money64 gGuestInitialCash; extern uint8_t gGuestInitialHappiness; extern uint8_t gGuestInitialHunger; extern uint8_t gGuestInitialThirst; diff --git a/src/openrct2/entity/Peep.cpp b/src/openrct2/entity/Peep.cpp index 98e84c1c32..9c51a3927c 100644 --- a/src/openrct2/entity/Peep.cpp +++ b/src/openrct2/entity/Peep.cpp @@ -69,7 +69,7 @@ uint32_t gNumGuestsInPark; uint32_t gNumGuestsInParkLastWeek; uint32_t gNumGuestsHeadingForPark; -money16 gGuestInitialCash; +money64 gGuestInitialCash; uint8_t gGuestInitialHappiness; uint8_t gGuestInitialHunger; uint8_t gGuestInitialThirst; @@ -1945,7 +1945,7 @@ static bool PeepInteractWithEntrance(Peep* peep, const CoordsXYE& coords, uint8_ return true; } - money16 entranceFee = ParkGetEntranceFee(); + auto entranceFee = ParkGetEntranceFee(); if (entranceFee != 0) { if (guest->HasItem(ShopItem::Voucher)) @@ -2320,15 +2320,12 @@ static bool PeepInteractWithShop(Peep* peep, const CoordsXYE& coords) return true; } - money16 cost = ride->price[0]; + auto cost = ride->price[0]; if (cost != 0 && !(gParkFlags & PARK_FLAGS_NO_MONEY)) { ride->total_profit += cost; ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; - // TODO: Refactor? SpendMoney previously accepted nullptr to not track money, passing a temporary variable as a - // workaround - money16 money = 0; - guest->SpendMoney(money, cost, ExpenditureType::ParkRideTickets); + guest->SpendMoney(cost, ExpenditureType::ParkRideTickets); } auto coordsCentre = coords.ToTileCentre(); diff --git a/src/openrct2/entity/Staff.cpp b/src/openrct2/entity/Staff.cpp index 4810c71d5e..eae925d0f1 100644 --- a/src/openrct2/entity/Staff.cpp +++ b/src/openrct2/entity/Staff.cpp @@ -2570,7 +2570,7 @@ void Staff::UpdateRideInspected(RideId rideIndex) } } -money32 GetStaffWage(StaffType type) +money64 GetStaffWage(StaffType type) { switch (type) { diff --git a/src/openrct2/entity/Staff.h b/src/openrct2/entity/Staff.h index 7250619f60..40b77f5f1b 100644 --- a/src/openrct2/entity/Staff.h +++ b/src/openrct2/entity/Staff.h @@ -153,7 +153,7 @@ bool StaffSetColour(StaffType staffType, colour_t value); uint32_t StaffGetAvailableEntertainerCostumes(); int32_t StaffGetAvailableEntertainerCostumeList(EntertainerCostume* costumeList); -money32 GetStaffWage(StaffType type); +money64 GetStaffWage(StaffType type); PeepSpriteType EntertainerCostumeToSprite(EntertainerCostume entertainerType); const PatrolArea& GetMergedPatrolArea(const StaffType type); diff --git a/src/openrct2/interface/InteractiveConsole.cpp b/src/openrct2/interface/InteractiveConsole.cpp index 78518dc2a5..0d10c88ab0 100644 --- a/src/openrct2/interface/InteractiveConsole.cpp +++ b/src/openrct2/interface/InteractiveConsole.cpp @@ -201,8 +201,8 @@ static int32_t ConsoleCommandRides(InteractiveConsole& console, const arguments_ } else { - int32_t res = SetOperatingSetting(RideId::FromUnderlying(ride_index), RideSetSetting::RideType, type); - if (res == MONEY32_UNDEFINED) + auto res = SetOperatingSetting(RideId::FromUnderlying(ride_index), RideSetSetting::RideType, type); + if (res == MONEY64_UNDEFINED) { if (!gCheatsAllowArbitraryRideTypeChanges) { @@ -431,7 +431,7 @@ static int32_t ConsoleCommandRides(InteractiveConsole& console, const arguments_ else { int32_t rideId = ConsoleParseInt(argv[2], &int_valid[0]); - money16 price = ConsoleParseInt(argv[3], &int_valid[1]); + money64 price = ConsoleParseInt(argv[3], &int_valid[1]); if (!int_valid[0] || !int_valid[1]) { @@ -762,7 +762,7 @@ static int32_t ConsoleCommandSet(InteractiveConsole& console, const arguments_t& if (argv[0] == "money" && InvalidArguments(&invalidArgs, double_valid[0])) { - money32 money = ToMoney64FromGBP(double_val[0]); + money64 money = ToMoney64FromGBP(double_val[0]); if (gCash != money) { auto cheatSetAction = CheatSetAction(CheatType::SetMoney, money); diff --git a/src/openrct2/interface/Window.h b/src/openrct2/interface/Window.h index 58b776bf41..552c5c8375 100644 --- a/src/openrct2/interface/Window.h +++ b/src/openrct2/interface/Window.h @@ -761,7 +761,7 @@ void WindowUnfollowSprite(WindowBase& w); bool WindowRideConstructionUpdateState( int32_t* trackType, int32_t* trackDirection, RideId* rideIndex, int32_t* _liftHillAndAlternativeState, CoordsXYZ* trackPos, int32_t* properties); -money32 PlaceProvisionalTrackPiece( +money64 PlaceProvisionalTrackPiece( RideId rideIndex, int32_t trackType, int32_t trackDirection, int32_t liftHillAndAlternativeState, const CoordsXYZ& trackPos); diff --git a/src/openrct2/localisation/Formatter.h b/src/openrct2/localisation/Formatter.h index f9cb4ca4f4..27d06939b5 100644 --- a/src/openrct2/localisation/Formatter.h +++ b/src/openrct2/localisation/Formatter.h @@ -89,7 +89,6 @@ public: std::is_same_v, const char*> || std::is_same_v, int16_t> || std::is_same_v, int32_t> || - std::is_same_v, money32> || std::is_same_v, money64> || std::is_same_v, RideId> || std::is_same_v, EntityId> || diff --git a/src/openrct2/management/Finance.cpp b/src/openrct2/management/Finance.cpp index 43aedf331f..025340238a 100644 --- a/src/openrct2/management/Finance.cpp +++ b/src/openrct2/management/Finance.cpp @@ -25,7 +25,7 @@ #include "../world/Park.h" // Monthly research funding costs -const money32 research_cost_table[RESEARCH_FUNDING_COUNT] = { +const money64 research_cost_table[RESEARCH_FUNDING_COUNT] = { 0.00_GBP, // No funding 100.00_GBP, // Minimum funding 200.00_GBP, // Normal funding @@ -146,10 +146,10 @@ void FinancePayInterest() } // This variable uses the 64-bit type as the computation below can involve multiplying very large numbers - // that will overflow money32 if the loan is greater than (1 << 31) / (5 * current_interest_rate) + // that will overflow money64 if the loan is greater than (1 << 31) / (5 * current_interest_rate) const money64 current_loan = gBankLoan; const auto current_interest_rate = gBankLoanInterestRate; - const money32 interest_to_pay = (gParkFlags & PARK_FLAGS_RCT1_INTEREST) ? (current_loan / 2400) + const money64 interest_to_pay = (gParkFlags & PARK_FLAGS_RCT1_INTEREST) ? (current_loan / 2400) : (current_loan * 5 * current_interest_rate) >> 14; FinancePayment(interest_to_pay, ExpenditureType::Interest); @@ -172,7 +172,7 @@ void FinancePayRideUpkeep() if (ride.status != RideStatus::Closed && !(gParkFlags & PARK_FLAGS_NO_MONEY)) { - int16_t upkeep = ride.upkeep_cost; + auto upkeep = ride.upkeep_cost; if (upkeep != -1) { ride.total_profit -= upkeep; @@ -252,7 +252,7 @@ void FinanceUpdateDailyProfit() gCurrentProfit = 7 * gCurrentExpenditure; gCurrentExpenditure = 0; // Reset daily expenditure - money32 current_profit = 0; + money64 current_profit = 0; if (!(gParkFlags & PARK_FLAGS_NO_MONEY)) { @@ -267,13 +267,13 @@ void FinanceUpdateDailyProfit() current_profit -= research_cost_table[level]; // Loan costs - money32 current_loan = gBankLoan; + auto current_loan = gBankLoan; current_profit -= current_loan / 600; // Ride costs for (auto& ride : GetRideManager()) { - if (ride.status != RideStatus::Closed && ride.upkeep_cost != MONEY16_UNDEFINED) + if (ride.status != RideStatus::Closed && ride.upkeep_cost != MONEY64_UNDEFINED) { current_profit -= 2 * ride.upkeep_cost; } diff --git a/src/openrct2/management/Finance.h b/src/openrct2/management/Finance.h index 4b586f6084..1473c35846 100644 --- a/src/openrct2/management/Finance.h +++ b/src/openrct2/management/Finance.h @@ -36,7 +36,7 @@ enum class ExpenditureType : int32_t constexpr const uint8_t MaxBankLoanInterestRate = 255; -extern const money32 research_cost_table[RESEARCH_FUNDING_COUNT]; +extern const money64 research_cost_table[RESEARCH_FUNDING_COUNT]; extern money64 gInitialCash; extern money64 gCash; diff --git a/src/openrct2/management/Marketing.cpp b/src/openrct2/management/Marketing.cpp index 350ad2d555..19dbfe4af9 100644 --- a/src/openrct2/management/Marketing.cpp +++ b/src/openrct2/management/Marketing.cpp @@ -24,7 +24,7 @@ #include "Finance.h" #include "NewsItem.h" -const money16 AdvertisingCampaignPricePerWeek[] = { +const money64 AdvertisingCampaignPricePerWeek[] = { 50.00_GBP, // PARK_ENTRY_FREE 50.00_GBP, // RIDE_FREE 50.00_GBP, // PARK_ENTRY_HALF_PRICE diff --git a/src/openrct2/management/Marketing.h b/src/openrct2/management/Marketing.h index a341d105f2..a18fc2c40f 100644 --- a/src/openrct2/management/Marketing.h +++ b/src/openrct2/management/Marketing.h @@ -60,7 +60,7 @@ namespace MarketingCampaignFlags constexpr uint8_t FIRST_WEEK = 1 << 0; } -extern const money16 AdvertisingCampaignPricePerWeek[ADVERTISING_CAMPAIGN_COUNT]; +extern const money64 AdvertisingCampaignPricePerWeek[ADVERTISING_CAMPAIGN_COUNT]; extern std::vector gMarketingCampaigns; uint16_t MarketingGetCampaignGuestGenerationProbability(int32_t campaign); diff --git a/src/openrct2/network/NetworkBase.cpp b/src/openrct2/network/NetworkBase.cpp index 94d2cbe6d2..9acf1dcaf9 100644 --- a/src/openrct2/network/NetworkBase.cpp +++ b/src/openrct2/network/NetworkBase.cpp @@ -43,7 +43,7 @@ // It is used for making sure only compatible builds get connected, even within // single OpenRCT2 version. -#define NETWORK_STREAM_VERSION "7" +#define NETWORK_STREAM_VERSION "8" #define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION @@ -3271,7 +3271,7 @@ int32_t NetworkGetPlayerID(uint32_t index) return network.player_list[index]->Id; } -money32 NetworkGetPlayerMoneySpent(uint32_t index) +money64 NetworkGetPlayerMoneySpent(uint32_t index) { auto& network = OpenRCT2::GetContext()->GetNetwork(); Guard::IndexInRange(index, network.player_list); @@ -3301,7 +3301,7 @@ std::string NetworkGetPlayerPublicKeyHash(uint32_t id) return {}; } -void NetworkAddPlayerMoneySpent(uint32_t index, money32 cost) +void NetworkAddPlayerMoneySpent(uint32_t index, money64 cost) { auto& network = OpenRCT2::GetContext()->GetNetwork(); Guard::IndexInRange(index, network.player_list); @@ -4027,7 +4027,7 @@ int32_t NetworkGetPlayerID(uint32_t index) { return 0; } -money32 NetworkGetPlayerMoneySpent(uint32_t index) +money64 NetworkGetPlayerMoneySpent(uint32_t index) { return 0.00_GBP; } @@ -4039,7 +4039,7 @@ std::string NetworkGetPlayerPublicKeyHash(uint32_t id) { return {}; } -void NetworkAddPlayerMoneySpent(uint32_t index, money32 cost) +void NetworkAddPlayerMoneySpent(uint32_t index, money64 cost) { } int32_t NetworkGetPlayerLastAction(uint32_t index, int32_t time) diff --git a/src/openrct2/network/NetworkPlayer.cpp b/src/openrct2/network/NetworkPlayer.cpp index a01dc50850..19459f829b 100644 --- a/src/openrct2/network/NetworkPlayer.cpp +++ b/src/openrct2/network/NetworkPlayer.cpp @@ -36,7 +36,7 @@ void NetworkPlayer::Write(NetworkPacket& packet) << CommandsRan; } -void NetworkPlayer::AddMoneySpent(money32 cost) +void NetworkPlayer::AddMoneySpent(money64 cost) { MoneySpent += cost; CommandsRan++; diff --git a/src/openrct2/network/NetworkPlayer.h b/src/openrct2/network/NetworkPlayer.h index 0c9fc600ee..17d965429b 100644 --- a/src/openrct2/network/NetworkPlayer.h +++ b/src/openrct2/network/NetworkPlayer.h @@ -28,7 +28,7 @@ public: uint16_t Ping = 0; uint8_t Flags = 0; uint8_t Group = 0; - money32 MoneySpent = 0.00_GBP; + money64 MoneySpent = 0.00_GBP; uint32_t CommandsRan = 0; int32_t LastAction = -999; uint32_t LastActionTime = 0; @@ -45,5 +45,5 @@ public: void Read(NetworkPacket& packet); void Write(NetworkPacket& packet); - void AddMoneySpent(money32 cost); + void AddMoneySpent(money64 cost); }; diff --git a/src/openrct2/network/network.h b/src/openrct2/network/network.h index d9948883bf..988374fc3b 100644 --- a/src/openrct2/network/network.h +++ b/src/openrct2/network/network.h @@ -61,10 +61,10 @@ void NetworkFlush(); [[nodiscard]] uint32_t NetworkGetPlayerFlags(uint32_t index); [[nodiscard]] int32_t NetworkGetPlayerPing(uint32_t index); [[nodiscard]] int32_t NetworkGetPlayerID(uint32_t index); -[[nodiscard]] money32 NetworkGetPlayerMoneySpent(uint32_t index); +[[nodiscard]] money64 NetworkGetPlayerMoneySpent(uint32_t index); [[nodiscard]] std::string NetworkGetPlayerIPAddress(uint32_t id); [[nodiscard]] std::string NetworkGetPlayerPublicKeyHash(uint32_t id); -void NetworkAddPlayerMoneySpent(uint32_t index, money32 cost); +void NetworkAddPlayerMoneySpent(uint32_t index, money64 cost); [[nodiscard]] int32_t NetworkGetPlayerLastAction(uint32_t index, int32_t time); void NetworkSetPlayerLastAction(uint32_t index, GameCommand command); [[nodiscard]] CoordsXYZ NetworkGetPlayerLastActionCoord(uint32_t index); diff --git a/src/openrct2/object/BannerObject.cpp b/src/openrct2/object/BannerObject.cpp index 7dd9420072..86d4cd6d9c 100644 --- a/src/openrct2/object/BannerObject.cpp +++ b/src/openrct2/object/BannerObject.cpp @@ -23,7 +23,7 @@ void BannerObject::ReadLegacy(IReadObjectContext* context, OpenRCT2::IStream* st stream->Seek(6, OpenRCT2::STREAM_SEEK_CURRENT); _legacyType.scrolling_mode = stream->ReadValue(); _legacyType.flags = stream->ReadValue(); - _legacyType.price = stream->ReadValue(); + _legacyType.price = stream->ReadValue(); _legacyType.scenery_tab_id = OBJECT_ENTRY_INDEX_NULL; stream->Seek(2, OpenRCT2::STREAM_SEEK_CURRENT); @@ -35,7 +35,7 @@ void BannerObject::ReadLegacy(IReadObjectContext* context, OpenRCT2::IStream* st GetImageTable().Read(context, stream); // Validate properties - if (_legacyType.price <= 0) + if (_legacyType.price <= 0.00_GBP) { context->LogError(ObjectError::InvalidProperty, "Price can not be free or negative."); } @@ -93,7 +93,7 @@ void BannerObject::ReadJson(IReadObjectContext* context, json_t& root) if (properties.is_object()) { _legacyType.scrolling_mode = Json::GetNumber(properties["scrollingMode"]); - _legacyType.price = Json::GetNumber(properties["price"]); + _legacyType.price = Json::GetNumber(properties["price"]); _legacyType.flags = Json::GetFlags( properties, { diff --git a/src/openrct2/object/BannerSceneryEntry.h b/src/openrct2/object/BannerSceneryEntry.h index d1cf260420..63ddca8c43 100644 --- a/src/openrct2/object/BannerSceneryEntry.h +++ b/src/openrct2/object/BannerSceneryEntry.h @@ -25,6 +25,6 @@ struct BannerSceneryEntry uint32_t image; uint8_t scrolling_mode; uint8_t flags; - int16_t price; + money64 price; ObjectEntryIndex scenery_tab_id; }; diff --git a/src/openrct2/object/FootpathItemEntry.h b/src/openrct2/object/FootpathItemEntry.h index 4729b52efd..0dd00f3645 100644 --- a/src/openrct2/object/FootpathItemEntry.h +++ b/src/openrct2/object/FootpathItemEntry.h @@ -43,6 +43,6 @@ struct PathBitEntry uint16_t flags; PathBitDrawType draw_type; CursorID tool_id; - money16 price; + money64 price; ObjectEntryIndex scenery_tab_id; }; diff --git a/src/openrct2/object/FootpathItemObject.cpp b/src/openrct2/object/FootpathItemObject.cpp index e7b4dcdcd9..4e82466c90 100644 --- a/src/openrct2/object/FootpathItemObject.cpp +++ b/src/openrct2/object/FootpathItemObject.cpp @@ -27,7 +27,7 @@ void FootpathItemObject::ReadLegacy(IReadObjectContext* context, OpenRCT2::IStre _legacyType.flags = stream->ReadValue(); _legacyType.draw_type = static_cast(stream->ReadValue()); _legacyType.tool_id = static_cast(stream->ReadValue()); - _legacyType.price = stream->ReadValue(); + _legacyType.price = stream->ReadValue(); _legacyType.scenery_tab_id = OBJECT_ENTRY_INDEX_NULL; stream->Seek(2, OpenRCT2::STREAM_SEEK_CURRENT); @@ -39,7 +39,7 @@ void FootpathItemObject::ReadLegacy(IReadObjectContext* context, OpenRCT2::IStre GetImageTable().Read(context, stream); // Validate properties - if (_legacyType.price <= 0) + if (_legacyType.price <= 0.00_GBP) { context->LogError(ObjectError::InvalidProperty, "Price can not be free or negative."); } @@ -109,7 +109,7 @@ void FootpathItemObject::ReadJson(IReadObjectContext* context, json_t& root) { _legacyType.draw_type = ParseDrawType(Json::GetString(properties["renderAs"])); _legacyType.tool_id = Cursor::FromString(Json::GetString(properties["cursor"]), CursorID::LamppostDown); - _legacyType.price = Json::GetNumber(properties["price"]); + _legacyType.price = Json::GetNumber(properties["price"]); SetPrimarySceneryGroup(ObjectEntryDescriptor(Json::GetString(properties["sceneryGroup"]))); diff --git a/src/openrct2/object/LargeSceneryEntry.h b/src/openrct2/object/LargeSceneryEntry.h index 36a1a911df..708ccc46a7 100644 --- a/src/openrct2/object/LargeSceneryEntry.h +++ b/src/openrct2/object/LargeSceneryEntry.h @@ -67,8 +67,8 @@ struct LargeSceneryEntry uint32_t image; CursorID tool_id; uint16_t flags; - money32 price; - money32 removal_price; + money64 price; + money64 removal_price; LargeSceneryTile* tiles; ObjectEntryIndex scenery_tab_id; uint8_t scrolling_mode; diff --git a/src/openrct2/object/LargeSceneryObject.cpp b/src/openrct2/object/LargeSceneryObject.cpp index f2598b05e0..ec7fc03b94 100644 --- a/src/openrct2/object/LargeSceneryObject.cpp +++ b/src/openrct2/object/LargeSceneryObject.cpp @@ -81,11 +81,11 @@ void LargeSceneryObject::ReadLegacy(IReadObjectContext* context, OpenRCT2::IStre GetImageTable().Read(context, stream); // Validate properties - if (_legacyType.price <= 0) + if (_legacyType.price <= 0.00_GBP) { context->LogError(ObjectError::InvalidProperty, "Price can not be free or negative."); } - if (_legacyType.removal_price <= 0) + if (_legacyType.removal_price <= 0.00_GBP) { // Make sure you don't make a profit when placing then removing. const auto reimbursement = _legacyType.removal_price; diff --git a/src/openrct2/object/SmallSceneryEntry.h b/src/openrct2/object/SmallSceneryEntry.h index 50b22c8188..e139bc1904 100644 --- a/src/openrct2/object/SmallSceneryEntry.h +++ b/src/openrct2/object/SmallSceneryEntry.h @@ -59,8 +59,8 @@ struct SmallSceneryEntry uint32_t flags; uint8_t height; CursorID tool_id; - money32 price; - money32 removal_price; + money64 price; + money64 removal_price; uint8_t* frame_offsets; uint16_t animation_delay; uint16_t animation_mask; diff --git a/src/openrct2/object/SmallSceneryObject.cpp b/src/openrct2/object/SmallSceneryObject.cpp index 6fcb91a3f6..9587ca9a8e 100644 --- a/src/openrct2/object/SmallSceneryObject.cpp +++ b/src/openrct2/object/SmallSceneryObject.cpp @@ -55,11 +55,11 @@ void SmallSceneryObject::ReadLegacy(IReadObjectContext* context, OpenRCT2::IStre GetImageTable().Read(context, stream); // Validate properties - if (_legacyType.price <= 0) + if (_legacyType.price <= 0.00_GBP) { context->LogError(ObjectError::InvalidProperty, "Price can not be free or negative."); } - if (_legacyType.removal_price <= 0) + if (_legacyType.removal_price <= 0.00_GBP) { // Make sure you don't make a profit when placing then removing. const auto reimbursement = _legacyType.removal_price; diff --git a/src/openrct2/object/TerrainSurfaceObject.cpp b/src/openrct2/object/TerrainSurfaceObject.cpp index a6a6cbdfe1..5740816776 100644 --- a/src/openrct2/object/TerrainSurfaceObject.cpp +++ b/src/openrct2/object/TerrainSurfaceObject.cpp @@ -87,7 +87,7 @@ void TerrainSurfaceObject::ReadJson(IReadObjectContext* context, json_t& root) { Colour = Colour::FromString(Json::GetString(properties["colour"]), 255); Rotations = Json::GetNumber(properties["rotations"], 1); - Price = Json::GetNumber(properties["price"]); + Price = Json::GetNumber(properties["price"]); Flags = Json::GetFlags( properties, { { "smoothWithSelf", TERRAIN_SURFACE_FLAGS::SMOOTH_WITH_SELF }, diff --git a/src/openrct2/object/TerrainSurfaceObject.h b/src/openrct2/object/TerrainSurfaceObject.h index 1b3a3c0c34..38e0e55542 100644 --- a/src/openrct2/object/TerrainSurfaceObject.h +++ b/src/openrct2/object/TerrainSurfaceObject.h @@ -51,7 +51,7 @@ public: colour_t Colour{}; uint8_t Rotations{}; - money32 Price{}; + money64 Price{}; TERRAIN_SURFACE_FLAGS Flags{}; PaletteIndex MapColours[2]{}; diff --git a/src/openrct2/object/WallObject.cpp b/src/openrct2/object/WallObject.cpp index a53cc3595b..5fa1c2f51a 100644 --- a/src/openrct2/object/WallObject.cpp +++ b/src/openrct2/object/WallObject.cpp @@ -25,7 +25,7 @@ void WallObject::ReadLegacy(IReadObjectContext* context, OpenRCT2::IStream* stre _legacyType.flags = stream->ReadValue(); _legacyType.height = stream->ReadValue(); _legacyType.flags2 = stream->ReadValue(); - _legacyType.price = stream->ReadValue(); + _legacyType.price = stream->ReadValue(); _legacyType.scenery_tab_id = OBJECT_ENTRY_INDEX_NULL; stream->Seek(1, OpenRCT2::STREAM_SEEK_CURRENT); _legacyType.scrolling_mode = stream->ReadValue(); @@ -38,7 +38,7 @@ void WallObject::ReadLegacy(IReadObjectContext* context, OpenRCT2::IStream* stre GetImageTable().Read(context, stream); // Validate properties - if (_legacyType.price <= 0) + if (_legacyType.price <= 0.00_GBP) { context->LogError(ObjectError::InvalidProperty, "Price can not be free or negative."); } @@ -104,7 +104,7 @@ void WallObject::ReadJson(IReadObjectContext* context, json_t& root) { _legacyType.tool_id = Cursor::FromString(Json::GetString(properties["cursor"]), CursorID::FenceDown); _legacyType.height = Json::GetNumber(properties["height"]); - _legacyType.price = Json::GetNumber(properties["price"]); + _legacyType.price = Json::GetNumber(properties["price"]); _legacyType.scrolling_mode = Json::GetNumber(properties["scrollingMode"], SCROLLING_MODE_NONE); diff --git a/src/openrct2/object/WallSceneryEntry.h b/src/openrct2/object/WallSceneryEntry.h index e7e18de101..bc9d70dc43 100644 --- a/src/openrct2/object/WallSceneryEntry.h +++ b/src/openrct2/object/WallSceneryEntry.h @@ -44,7 +44,7 @@ struct WallSceneryEntry uint8_t flags; uint8_t height; uint8_t flags2; - money16 price; + money64 price; ObjectEntryIndex scenery_tab_id; uint8_t scrolling_mode; }; diff --git a/src/openrct2/park/ParkFile.cpp b/src/openrct2/park/ParkFile.cpp index fff4b7014e..f7e0bc3042 100644 --- a/src/openrct2/park/ParkFile.cpp +++ b/src/openrct2/park/ParkFile.cpp @@ -464,7 +464,8 @@ namespace OpenRCT2 void ReadWriteGeneralChunk(OrcaStream& os) { - auto found = os.ReadWriteChunk(ParkFileChunkType::GENERAL, [this, &os](OrcaStream::ChunkStream& cs) { + const auto version = os.GetHeader().TargetVersion; + auto found = os.ReadWriteChunk(ParkFileChunkType::GENERAL, [this, &os, &version](OrcaStream::ChunkStream& cs) { // Only GAME_PAUSED_NORMAL from gGamePaused is relevant. if (cs.GetMode() == OrcaStream::Mode::READING) { @@ -497,7 +498,16 @@ namespace OpenRCT2 } cs.ReadWrite(gGuestInitialHappiness); - cs.ReadWrite(gGuestInitialCash); + if (version <= 18) + { + money16 tempGuestInitialCash{}; + cs.ReadWrite(tempGuestInitialCash); + gGuestInitialCash = ToMoney64(tempGuestInitialCash); + } + else + { + cs.ReadWrite(gGuestInitialCash); + } cs.ReadWrite(gGuestInitialHunger); cs.ReadWrite(gGuestInitialThirst); @@ -509,8 +519,20 @@ namespace OpenRCT2 cs.ReadWrite(spawn.direction); }); - cs.ReadWrite(gLandPrice); - cs.ReadWrite(gConstructionRightsPrice); + if (version <= 18) + { + money16 tempLandPrice{}; + money16 tempConstructionRightPrice{}; + cs.ReadWrite(tempLandPrice); + cs.ReadWrite(tempConstructionRightPrice); + gLandPrice = ToMoney64(tempLandPrice); + gConstructionRightsPrice = ToMoney64(tempConstructionRightPrice); + } + else + { + cs.ReadWrite(gLandPrice); + cs.ReadWrite(gConstructionRightsPrice); + } cs.ReadWrite(gGrassSceneryTileLoopPosition); cs.ReadWrite(gWidePathTileLoopPosition); @@ -748,7 +770,17 @@ namespace OpenRCT2 cs.ReadWrite(gMaxBankLoan); cs.ReadWrite(gBankLoanInterestRate); cs.ReadWrite(gParkFlags); - cs.ReadWrite(gParkEntranceFee); + if (version <= 18) + { + money16 tempParkEntranceFee{}; + cs.ReadWrite(tempParkEntranceFee); + gParkEntranceFee = ToMoney64(tempParkEntranceFee); + } + else + { + cs.ReadWrite(gParkEntranceFee); + } + cs.ReadWrite(gStaffHandymanColour); cs.ReadWrite(gStaffMechanicColour); cs.ReadWrite(gStaffSecurityColour); @@ -1212,10 +1244,23 @@ namespace OpenRCT2 cs.ReadWrite(ride.custom_name); cs.ReadWrite(ride.default_name_number); - cs.ReadWriteArray(ride.price, [&cs](money16& price) { - cs.ReadWrite(price); - return true; - }); + if (version <= 18) + { + money16 prices[2] = {}; + cs.ReadWriteArray(prices, [&cs](money16& price) { + cs.ReadWrite(price); + return true; + }); + ride.price[0] = prices[0]; + ride.price[1] = prices[1]; + } + else + { + cs.ReadWriteArray(ride.price, [&cs](money64& price) { + cs.ReadWrite(price); + return true; + }); + } // Colours cs.ReadWrite(ride.entrance_style); @@ -1362,11 +1407,30 @@ namespace OpenRCT2 cs.ReadWrite(ride.intensity); cs.ReadWrite(ride.nausea); - cs.ReadWrite(ride.value); + if (version <= 18) + { + uint16_t tempRideValue{}; + cs.ReadWrite(tempRideValue); + ride.value = ToMoney64(tempRideValue); + } + else + { + cs.ReadWrite(ride.value); + } cs.ReadWrite(ride.num_riders); cs.ReadWrite(ride.build_date); - cs.ReadWrite(ride.upkeep_cost); + + if (version <= 18) + { + money16 tempUpkeepCost{}; + cs.ReadWrite(tempUpkeepCost); + ride.upkeep_cost = ToMoney64(tempUpkeepCost); + } + else + { + cs.ReadWrite(ride.upkeep_cost); + } cs.ReadWrite(ride.cur_num_customers); cs.ReadWrite(ride.num_customers_timeout); @@ -1610,7 +1674,9 @@ namespace OpenRCT2 { if (guest != nullptr) { - cs.ReadWrite(guest->PaidOnDrink); + money16 tempPaidOnDrink{}; + cs.ReadWrite(tempPaidOnDrink); + guest->PaidOnDrink = ToMoney64(tempPaidOnDrink); std::array rideTypeBeenOn; cs.ReadWriteArray(rideTypeBeenOn, [&cs](uint8_t& rideType) { cs.ReadWrite(rideType); @@ -1695,8 +1761,13 @@ namespace OpenRCT2 { if (guest != nullptr) { - cs.ReadWrite(guest->CashInPocket); - cs.ReadWrite(guest->CashSpent); + money32 tempCashInPocket{}; + money32 tempCashSpent{}; + cs.ReadWrite(tempCashInPocket); + cs.ReadWrite(tempCashSpent); + guest->CashInPocket = ToMoney64(tempCashInPocket); + guest->CashSpent = ToMoney64(tempCashSpent); + cs.ReadWrite(guest->ParkEntryTime); cs.ReadWrite(guest->RejoinQueueTimeout); cs.ReadWrite(guest->PreviousRide); @@ -1779,10 +1850,17 @@ namespace OpenRCT2 cs.ReadWrite(guest->LitterCount); cs.ReadWrite(guest->GuestTimeOnRide); cs.ReadWrite(guest->DisgustingCount); - cs.ReadWrite(guest->PaidToEnter); - cs.ReadWrite(guest->PaidOnRides); - cs.ReadWrite(guest->PaidOnFood); - cs.ReadWrite(guest->PaidOnSouvenirs); + + money16 expenditures[4]{}; + cs.ReadWrite(expenditures[0]); + cs.ReadWrite(expenditures[1]); + cs.ReadWrite(expenditures[2]); + cs.ReadWrite(expenditures[3]); + guest->PaidToEnter = ToMoney64(expenditures[0]); + guest->PaidOnRides = ToMoney64(expenditures[1]); + guest->PaidOnFood = ToMoney64(expenditures[2]); + guest->PaidOnSouvenirs = ToMoney64(expenditures[3]); + cs.ReadWrite(guest->AmountOfFood); cs.ReadWrite(guest->AmountOfDrinks); cs.ReadWrite(guest->AmountOfSouvenirs); @@ -1968,8 +2046,9 @@ namespace OpenRCT2 template<> void ParkFile::ReadWriteEntity(OrcaStream& os, OrcaStream::ChunkStream& cs, Guest& guest) { ReadWritePeep(os, cs, guest); + auto version = os.GetHeader().TargetVersion; - if (os.GetHeader().TargetVersion <= 1) + if (version <= 1) { return; } @@ -1980,11 +2059,30 @@ namespace OpenRCT2 cs.ReadWrite(guest.GuestHeadingToRideId); cs.ReadWrite(guest.GuestIsLostCountdown); cs.ReadWrite(guest.GuestTimeOnRide); - cs.ReadWrite(guest.PaidToEnter); - cs.ReadWrite(guest.PaidOnRides); - cs.ReadWrite(guest.PaidOnFood); - cs.ReadWrite(guest.PaidOnDrink); - cs.ReadWrite(guest.PaidOnSouvenirs); + + if (version <= 18) + { + money16 expenditures[5]{}; + cs.ReadWrite(expenditures[0]); + cs.ReadWrite(expenditures[1]); + cs.ReadWrite(expenditures[2]); + cs.ReadWrite(expenditures[3]); + cs.ReadWrite(expenditures[4]); + guest.PaidToEnter = ToMoney64(expenditures[0]); + guest.PaidOnRides = ToMoney64(expenditures[1]); + guest.PaidOnFood = ToMoney64(expenditures[2]); + guest.PaidOnDrink = ToMoney64(expenditures[3]); + guest.PaidOnSouvenirs = ToMoney64(expenditures[4]); + } + else + { + cs.ReadWrite(guest.PaidToEnter); + cs.ReadWrite(guest.PaidOnRides); + cs.ReadWrite(guest.PaidOnFood); + cs.ReadWrite(guest.PaidOnDrink); + cs.ReadWrite(guest.PaidOnSouvenirs); + } + cs.ReadWrite(guest.OutsideOfPark); cs.ReadWrite(guest.Happiness); cs.ReadWrite(guest.HappinessTarget); @@ -2059,8 +2157,21 @@ namespace OpenRCT2 } } } - cs.ReadWrite(guest.CashInPocket); - cs.ReadWrite(guest.CashSpent); + if (version <= 18) + { + money32 tempCashInPocket{}; + money32 tempCashSpent{}; + cs.ReadWrite(tempCashInPocket); + cs.ReadWrite(tempCashSpent); + guest.CashInPocket = ToMoney64(tempCashInPocket); + guest.CashSpent = ToMoney64(tempCashSpent); + } + else + { + cs.ReadWrite(guest.CashInPocket); + cs.ReadWrite(guest.CashSpent); + } + cs.ReadWrite(guest.Photo1RideRef); cs.ReadWrite(guest.Photo2RideRef); cs.ReadWrite(guest.Photo3RideRef); diff --git a/src/openrct2/park/ParkFile.h b/src/openrct2/park/ParkFile.h index 42680c7a88..2c96373f75 100644 --- a/src/openrct2/park/ParkFile.h +++ b/src/openrct2/park/ParkFile.h @@ -9,10 +9,10 @@ struct ObjectRepositoryItem; namespace OpenRCT2 { // Current version that is saved. - constexpr uint32_t PARK_FILE_CURRENT_VERSION = 18; + constexpr uint32_t PARK_FILE_CURRENT_VERSION = 19; // The minimum version that is forwards compatible with the current version. - constexpr uint32_t PARK_FILE_MIN_VERSION = 18; + constexpr uint32_t PARK_FILE_MIN_VERSION = 19; // The minimum version that is backwards compatible with the current version. // If this is increased beyond 0, uncomment the checks in ParkFile.cpp and Context.cpp! diff --git a/src/openrct2/rct1/RCT1.h b/src/openrct2/rct1/RCT1.h index 35f0e7bc55..69c420e280 100644 --- a/src/openrct2/rct1/RCT1.h +++ b/src/openrct2/rct1/RCT1.h @@ -220,7 +220,7 @@ namespace RCT1 ride_rating Nausea; // 0x0F4 }; }; - uint16_t Value; // 0x0F6 + money16 Value; // 0x0F6 uint16_t ChairliftBullwheelRotation; // 0x0F8 uint8_t Satisfaction; // 0x0FA uint8_t SatisfactionTimeOut; // 0x0FB diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 48baaf5dbd..65957055e9 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -259,11 +259,11 @@ namespace RCT1 return true; } - money32 CorrectRCT1ParkValue(money32 oldParkValue) + money64 CorrectRCT1ParkValue(money32 oldParkValue) { if (oldParkValue == MONEY32_UNDEFINED) { - return MONEY32_UNDEFINED; + return MONEY64_UNDEFINED; } if (_parkValueConversionFactor == 0) @@ -1030,14 +1030,14 @@ namespace RCT1 dst->maze_tiles = src->MazeTiles; // Finance / customers - dst->upkeep_cost = src->UpkeepCost; + dst->upkeep_cost = ToMoney64(src->UpkeepCost); dst->price[0] = src->Price; dst->price[1] = src->PriceSecondary; dst->income_per_hour = ToMoney64(src->IncomePerHour); dst->total_customers = src->TotalCustomers; dst->profit = ToMoney64(src->Profit); dst->total_profit = ToMoney64(src->TotalProfit); - dst->value = src->Value; + dst->value = ToMoney64(src->Value); for (size_t i = 0; i < std::size(src->NumCustomers); i++) { dst->num_customers[i] = src->NumCustomers[i]; @@ -1392,8 +1392,8 @@ namespace RCT1 void ImportFinance() { gParkEntranceFee = _s4.ParkEntranceFee; - gLandPrice = _s4.LandPrice; - gConstructionRightsPrice = _s4.ConstructionRightsPrice; + gLandPrice = ToMoney64(_s4.LandPrice); + gConstructionRightsPrice = ToMoney64(_s4.ConstructionRightsPrice); gCash = ToMoney64(_s4.Cash); gBankLoan = ToMoney64(_s4.Loan); @@ -1403,13 +1403,13 @@ namespace RCT1 gInitialCash = ToMoney64(_s4.Cash); gCompanyValue = ToMoney64(_s4.CompanyValue); - gParkValue = ToMoney64(CorrectRCT1ParkValue(_s4.ParkValue)); + gParkValue = CorrectRCT1ParkValue(_s4.ParkValue); gCurrentProfit = ToMoney64(_s4.Profit); for (size_t i = 0; i < Limits::FinanceGraphSize; i++) { gCashHistory[i] = ToMoney64(_s4.CashHistory[i]); - gParkValueHistory[i] = ToMoney64(CorrectRCT1ParkValue(_s4.ParkValueHistory[i])); + gParkValueHistory[i] = CorrectRCT1ParkValue(_s4.ParkValueHistory[i]); gWeeklyProfitHistory[i] = ToMoney64(_s4.WeeklyProfitHistory[i]); } @@ -2187,7 +2187,7 @@ namespace RCT1 } // Initial guest status - gGuestInitialCash = _s4.GuestInitialCash; + gGuestInitialCash = ToMoney64(_s4.GuestInitialCash); gGuestInitialHunger = _s4.GuestInitialHunger; gGuestInitialThirst = _s4.GuestInitialThirst; gGuestInitialHappiness = _s4.GuestInitialHappiness; @@ -2331,7 +2331,7 @@ namespace RCT1 // This is corrected here, but since scenario_objective_currency doubles as minimum excitement rating, // we need to check the goal to avoid affecting scenarios like Volcania. if (_s4.ScenarioObjectiveType == OBJECTIVE_PARK_VALUE_BY) - gScenarioObjective.Currency = ToMoney64(CorrectRCT1ParkValue(_s4.ScenarioObjectiveCurrency)); + gScenarioObjective.Currency = CorrectRCT1ParkValue(_s4.ScenarioObjectiveCurrency); else gScenarioObjective.Currency = ToMoney64(_s4.ScenarioObjectiveCurrency); diff --git a/src/openrct2/rct1/T4Importer.cpp b/src/openrct2/rct1/T4Importer.cpp index 5d0f7a4bdb..333739ef04 100644 --- a/src/openrct2/rct1/T4Importer.cpp +++ b/src/openrct2/rct1/T4Importer.cpp @@ -232,7 +232,7 @@ namespace RCT1 td->excitement = td4Base.Excitement; td->intensity = td4Base.Intensity; td->nausea = td4Base.Nausea; - td->upkeep_cost = td4Base.UpkeepCost; + td->upkeep_cost = ToMoney64(td4Base.UpkeepCost); td->space_required_x = 255; td->space_required_y = 255; td->lift_hill_speed = 5; diff --git a/src/openrct2/rct2/RCT2.h b/src/openrct2/rct2/RCT2.h index 1b61775f55..08c6d01e8b 100644 --- a/src/openrct2/rct2/RCT2.h +++ b/src/openrct2/rct2/RCT2.h @@ -195,7 +195,7 @@ namespace RCT2 ride_rating Nausea; // 0x144 }; }; - uint16_t Value; // 0x146 + money16 Value; // 0x146 uint16_t ChairliftBullwheelRotation; // 0x148 uint8_t Satisfaction; // 0x14A uint8_t SatisfactionTimeOut; // 0x14B diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 5e68c1659b..7a86c840f2 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -338,7 +338,7 @@ namespace RCT2 _guestGenerationProbability = _s6.GuestGenerationProbability; gTotalRideValueForMoney = _s6.TotalRideValueForMoney; gMaxBankLoan = ToMoney64(_s6.MaximumLoan); - gGuestInitialCash = _s6.GuestInitialCash; + gGuestInitialCash = ToMoney64(_s6.GuestInitialCash); gGuestInitialHunger = _s6.GuestInitialHunger; gGuestInitialThirst = _s6.GuestInitialThirst; gScenarioObjective.Type = _s6.ObjectiveType; @@ -384,8 +384,8 @@ namespace RCT2 } } - gLandPrice = _s6.LandPrice; - gConstructionRightsPrice = _s6.ConstructionRightsPrice; + gLandPrice = ToMoney64(_s6.LandPrice); + gConstructionRightsPrice = ToMoney64(_s6.ConstructionRightsPrice); // unk_01358774 // Pad01358776 // _s6.CdKey @@ -951,7 +951,7 @@ namespace RCT2 } dst->ratings = src->Ratings; - dst->value = src->Value; + dst->value = ToMoney64(src->Value); dst->chairlift_bullwheel_rotation = src->ChairliftBullwheelRotation; @@ -980,7 +980,7 @@ namespace RCT2 dst->spiral_slide_progress = src->SpiralSlideProgress; // Pad177[0x9]; dst->build_date = static_cast(src->BuildDate); - dst->upkeep_cost = src->UpkeepCost; + dst->upkeep_cost = ToMoney64(src->UpkeepCost); dst->race_winner = EntityId::FromUnderlying(src->RaceWinner); // Pad186[0x02]; dst->music_position = src->MusicPosition; diff --git a/src/openrct2/rct2/T6Exporter.cpp b/src/openrct2/rct2/T6Exporter.cpp index 974079c807..ec41a4f12e 100644 --- a/src/openrct2/rct2/T6Exporter.cpp +++ b/src/openrct2/rct2/T6Exporter.cpp @@ -83,7 +83,7 @@ namespace RCT2 tempStream.WriteValue(_trackDesign->excitement); tempStream.WriteValue(_trackDesign->intensity); tempStream.WriteValue(_trackDesign->nausea); - tempStream.WriteValue(_trackDesign->upkeep_cost); + tempStream.WriteValue(ToMoney16(_trackDesign->upkeep_cost)); tempStream.WriteArray(_trackDesign->track_spine_colour, Limits::NumColourSchemes); tempStream.WriteArray(_trackDesign->track_rail_colour, Limits::NumColourSchemes); tempStream.WriteArray(_trackDesign->track_support_colour, Limits::NumColourSchemes); diff --git a/src/openrct2/rct2/T6Importer.cpp b/src/openrct2/rct2/T6Importer.cpp index 1f44c2e493..bf13650ef2 100644 --- a/src/openrct2/rct2/T6Importer.cpp +++ b/src/openrct2/rct2/T6Importer.cpp @@ -74,7 +74,7 @@ namespace RCT2 td->type = td6.Type; // 0x00 td->vehicle_type = td6.VehicleType; - td->cost = 0; + td->cost = 0.00_GBP; td->flags = td6.Flags; td->ride_mode = static_cast(td6.RideMode); td->track_flags = 0; @@ -114,7 +114,7 @@ namespace RCT2 td->excitement = td6.Excitement; td->intensity = td6.Intensity; td->nausea = td6.Nausea; - td->upkeep_cost = td6.UpkeepCost; + td->upkeep_cost = ToMoney64(td6.UpkeepCost); for (auto i = 0; i < Limits::NumColourSchemes; ++i) { td->track_spine_colour[i] = td6.TrackSpineColour[i]; diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index 548955061d..bdedbe61d6 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -424,7 +424,7 @@ money64 Ride::CalculateIncomePerHour() const if (currentShopItem != ShopItem::None) { - const money16 shopItemProfit = price[1] - GetShopItemDescriptor(currentShopItem).Cost; + const money64 shopItemProfit = price[1] - GetShopItemDescriptor(currentShopItem).Cost; if (GetShopItemDescriptor(currentShopItem).IsPhoto()) { @@ -1098,8 +1098,8 @@ void Ride::Update() income_per_hour = CalculateIncomePerHour(); window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; - if (upkeep_cost != MONEY16_UNDEFINED) - profit = (income_per_hour - (static_cast(upkeep_cost * 16))); + if (upkeep_cost != MONEY64_UNDEFINED) + profit = income_per_hour - (upkeep_cost * 16); } // Ride specific updates @@ -4208,7 +4208,7 @@ void Ride::SetColourPreset(uint8_t index) colour_scheme_type = 0; } -money32 RideGetCommonPrice(const Ride& forRide) +money64 RideGetCommonPrice(const Ride& forRide) { for (const auto& ride : GetRideManager()) { @@ -4218,7 +4218,7 @@ money32 RideGetCommonPrice(const Ride& forRide) } } - return MONEY32_UNDEFINED; + return MONEY64_UNDEFINED; } void Ride::SetNameToDefault() @@ -5177,7 +5177,7 @@ bool Ride::IsRide() const return GetClassification() == RideClassification::Ride; } -money16 RideGetPrice(const Ride& ride) +money64 RideGetPrice(const Ride& ride) { if (gParkFlags & PARK_FLAGS_NO_MONEY) return 0; diff --git a/src/openrct2/ride/Ride.h b/src/openrct2/ride/Ride.h index 5fcb564c18..fdd37c78fe 100644 --- a/src/openrct2/ride/Ride.h +++ b/src/openrct2/ride/Ride.h @@ -187,7 +187,7 @@ struct Ride uint16_t num_customers_timeout; // Customer count in the last 10 * 960 game ticks (sliding window) uint16_t num_customers[OpenRCT2::Limits::CustomerHistorySize]; - money16 price[RCT2::ObjectLimits::MaxShopItemsPerRideEntry]; + money64 price[RCT2::ObjectLimits::MaxShopItemsPerRideEntry]; TileCoordsXYZ ChairliftBullwheelLocation[2]; union { @@ -199,7 +199,7 @@ struct Ride ride_rating nausea; }; }; - uint16_t value; + money64 value; uint16_t chairlift_bullwheel_rotation; uint8_t satisfaction; uint8_t satisfaction_time_out; @@ -222,7 +222,7 @@ struct Ride uint8_t slide_peep_t_shirt_colour; uint8_t spiral_slide_progress; int32_t build_date; - money16 upkeep_cost; + money64 upkeep_cost; EntityId race_winner; uint32_t music_position; uint8_t breakdown_reason_pending; @@ -893,7 +893,7 @@ enum }; #define MAX_RIDE_MEASUREMENTS 8 -#define RIDE_VALUE_UNDEFINED 0xFFFF +constexpr money64 RIDE_VALUE_UNDEFINED = MONEY64_UNDEFINED; #define RIDE_INITIAL_RELIABILITY ((100 << 8) | 0xFF) // Upper byte is percentage, lower byte is "decimal". #define STATION_DEPART_FLAG (1 << 7) @@ -1029,9 +1029,9 @@ void RideSetMapTooltip(TileElement* tileElement); void RidePrepareBreakdown(Ride& ride, int32_t breakdownReason); TileElement* RideGetStationStartTrackElement(const Ride& ride, StationIndex stationIndex); TileElement* RideGetStationExitElement(const CoordsXYZ& elementPos); -int32_t RideGetRefundPrice(const Ride& ride); +money64 RideGetRefundPrice(const Ride& ride); int32_t RideGetRandomColourPresetIndex(ride_type_t rideType); -money32 RideGetCommonPrice(const Ride& forRide); +money64 RideGetCommonPrice(const Ride& forRide); void RideClearForConstruction(Ride& ride); void InvalidateTestResults(Ride& ride); @@ -1061,7 +1061,7 @@ bool TrackBlockGetPreviousFromZero( void RideGetStartOfTrack(CoordsXYE* output); void WindowRideConstructionUpdateActiveElements(); -money32 RideEntranceExitPlaceGhost( +money64 RideEntranceExitPlaceGhost( const Ride& ride, const CoordsXY& entranceExitCoords, Direction direction, int32_t placeType, StationIndex stationNum); ResultWithMessage RideAreAllPossibleEntrancesAndExitsBuilt(const Ride& ride); @@ -1073,8 +1073,8 @@ void RideUpdateVehicleColours(const Ride& ride); OpenRCT2::BitSet RideEntryGetSupportedTrackPieces(const RideObjectEntry& rideEntry); enum class RideSetSetting : uint8_t; -money32 SetOperatingSetting(RideId rideId, RideSetSetting setting, uint8_t value); -money32 SetOperatingSettingNested(RideId rideId, RideSetSetting setting, uint8_t value, uint8_t flags); +money64 SetOperatingSetting(RideId rideId, RideSetSetting setting, uint8_t value); +money64 SetOperatingSettingNested(RideId rideId, RideSetSetting setting, uint8_t value, uint8_t flags); void UpdateGhostTrackAndArrow(); @@ -1083,7 +1083,7 @@ uint32_t RideCustomersInLast5Minutes(const Ride& ride); Vehicle* RideGetBrokenVehicle(const Ride& ride); -money16 RideGetPrice(const Ride& ride); +money64 RideGetPrice(const Ride& ride); TileElement* GetStationPlatform(const CoordsXYRangedZ& coords); bool RideHasAdjacentStation(const Ride& ride); diff --git a/src/openrct2/ride/RideConstruction.cpp b/src/openrct2/ride/RideConstruction.cpp index c9aea7ea26..61083d39db 100644 --- a/src/openrct2/ride/RideConstruction.cpp +++ b/src/openrct2/ride/RideConstruction.cpp @@ -52,7 +52,7 @@ using namespace OpenRCT2::TrackMetaData; money64 gTotalRideValueForMoney; -money32 _currentTrackPrice; +money64 _currentTrackPrice; uint32_t _currentTrackCurve; RideConstructionState _rideConstructionState; @@ -633,7 +633,7 @@ void RideConstructionSetDefaultNextPiece() TrackBeginEnd trackBeginEnd; CoordsXYE xyElement; TileElement* tileElement; - _currentTrackPrice = MONEY32_UNDEFINED; + _currentTrackPrice = MONEY64_UNDEFINED; const TrackElementDescriptor* ted; switch (_rideConstructionState) @@ -1134,10 +1134,10 @@ int32_t RideInitialiseConstructionWindow(Ride& ride) * * rct2: 0x006CB7FB */ -int32_t RideGetRefundPrice(const Ride& ride) +money64 RideGetRefundPrice(const Ride& ride) { CoordsXYE trackElement; - money32 cost = 0; + money64 cost = 0; if (!RideTryGetOriginElement(ride, &trackElement)) { @@ -1188,20 +1188,20 @@ int32_t RideGetRefundPrice(const Ride& ride) return cost; } -money32 SetOperatingSetting(RideId rideId, RideSetSetting setting, uint8_t value) +money64 SetOperatingSetting(RideId rideId, RideSetSetting setting, uint8_t value) { auto rideSetSetting = RideSetSettingAction(rideId, setting, value); auto res = GameActions::Execute(&rideSetSetting); - return res.Error == GameActions::Status::Ok ? 0 : MONEY32_UNDEFINED; + return res.Error == GameActions::Status::Ok ? 0 : MONEY64_UNDEFINED; } -money32 SetOperatingSettingNested(RideId rideId, RideSetSetting setting, uint8_t value, uint8_t flags) +money64 SetOperatingSettingNested(RideId rideId, RideSetSetting setting, uint8_t value, uint8_t flags) { auto rideSetSetting = RideSetSettingAction(rideId, setting, value); rideSetSetting.SetFlags(flags); auto res = flags & GAME_COMMAND_FLAG_APPLY ? GameActions::ExecuteNested(&rideSetSetting) : GameActions::QueryNested(&rideSetSetting); - return res.Error == GameActions::Status::Ok ? 0 : MONEY32_UNDEFINED; + return res.Error == GameActions::Status::Ok ? 0 : MONEY64_UNDEFINED; } /** diff --git a/src/openrct2/ride/RideConstruction.h b/src/openrct2/ride/RideConstruction.h index e8a115a161..52e88b95f6 100644 --- a/src/openrct2/ride/RideConstruction.h +++ b/src/openrct2/ride/RideConstruction.h @@ -35,7 +35,7 @@ enum class RideConstructionState : uint8_t MazeFill }; -extern money32 _currentTrackPrice; +extern money64 _currentTrackPrice; extern uint32_t _currentTrackCurve; extern RideConstructionState _rideConstructionState; diff --git a/src/openrct2/ride/RideData.h b/src/openrct2/ride/RideData.h index 1c8840ebb1..9828919e60 100644 --- a/src/openrct2/ride/RideData.h +++ b/src/openrct2/ride/RideData.h @@ -152,16 +152,16 @@ struct UpkeepCostsDescriptor * * Data generation script: https://gist.github.com/kevinburke/6bcf4a8fcc95faad7bac */ - uint8_t BaseCost; + money64 BaseCost; /** rct2: 0x0097E3AC */ uint8_t TrackLengthMultiplier; - uint8_t CostPerTrackPiece; + money64 CostPerTrackPiece; /** rct2: 0x0097E3B4 */ - uint8_t CostPerTrain; + money64 CostPerTrain; /** rct2: 0x0097E3B6 */ - uint8_t CostPerCar; + money64 CostPerCar; /** rct2: 0x0097E3B8 */ - uint8_t CostPerStation; + money64 CostPerStation; }; using RideTrackGroup = OpenRCT2::BitSet; @@ -218,7 +218,7 @@ struct RideTypeDescriptor UpkeepCostsDescriptor UpkeepCosts; // rct2: 0x0097DD78 RideBuildCost BuildCosts; - money16 DefaultPrices[RCT2::ObjectLimits::MaxShopItemsPerRideEntry]; + money64 DefaultPrices[RCT2::ObjectLimits::MaxShopItemsPerRideEntry]; std::string_view DefaultMusic; /** rct2: 0x0097D7CB */ ShopItemIndex PhotoItem; diff --git a/src/openrct2/ride/RideRatings.cpp b/src/openrct2/ride/RideRatings.cpp index 63c39053be..c6afa920a3 100644 --- a/src/openrct2/ride/RideRatings.cpp +++ b/src/openrct2/ride/RideRatings.cpp @@ -836,7 +836,7 @@ static void RideRatingsCalculateValue(Ride& ride) // Start with the base ratings, multiplied by the ride type specific weights for excitement, intensity and nausea. const auto& ratingsMultipliers = ride.GetRideTypeDescriptor().RatingsMultipliers; - int32_t value = (((ride.excitement * ratingsMultipliers.Excitement) * 32) >> 15) + money64 value = (((ride.excitement * ratingsMultipliers.Excitement) * 32) >> 15) + (((ride.intensity * ratingsMultipliers.Intensity) * 32) >> 15) + (((ride.nausea * ratingsMultipliers.Nausea) * 32) >> 15); @@ -885,7 +885,7 @@ static void RideRatingsCalculateValue(Ride& ride) if (otherRidesOfSameType > 1) value -= value / 4; - ride.value = std::max(0, value); + ride.value = std::max(0.00_GBP, value); } /** @@ -894,12 +894,12 @@ static void RideRatingsCalculateValue(Ride& ride) * inputs * - edi: ride ptr */ -static uint16_t ride_compute_upkeep(RideRatingUpdateState& state, const Ride& ride) +static money64 ride_compute_upkeep(RideRatingUpdateState& state, const Ride& ride) { // data stored at 0x0057E3A8, incrementing 18 bytes at a time - uint16_t upkeep = ride.GetRideTypeDescriptor().UpkeepCosts.BaseCost; + auto upkeep = ride.GetRideTypeDescriptor().UpkeepCosts.BaseCost; - uint16_t trackCost = ride.GetRideTypeDescriptor().UpkeepCosts.CostPerTrackPiece; + auto trackCost = ride.GetRideTypeDescriptor().UpkeepCosts.CostPerTrackPiece; uint8_t dropFactor = ride.drops; dropFactor >>= 6; diff --git a/src/openrct2/ride/ShopItem.cpp b/src/openrct2/ride/ShopItem.cpp index 043a81ea70..443f0b9461 100644 --- a/src/openrct2/ride/ShopItem.cpp +++ b/src/openrct2/ride/ShopItem.cpp @@ -115,7 +115,7 @@ uint64_t ShopItemsGetAllContainers() return AllContainerFlags; } -money32 ShopItemGetCommonPrice(Ride* forRide, const ShopItem shopItem) +money64 ShopItemGetCommonPrice(Ride* forRide, const ShopItem shopItem) { for (const auto& ride : GetRideManager()) { @@ -141,7 +141,7 @@ money32 ShopItemGetCommonPrice(Ride* forRide, const ShopItem shopItem) } } - return MONEY32_UNDEFINED; + return MONEY64_UNDEFINED; } bool ShopItemHasCommonPrice(const ShopItem shopItem) diff --git a/src/openrct2/ride/ShopItem.h b/src/openrct2/ride/ShopItem.h index e0a0b1e306..77ff1ce3c5 100644 --- a/src/openrct2/ride/ShopItem.h +++ b/src/openrct2/ride/ShopItem.h @@ -88,11 +88,11 @@ struct ShopItemStrings struct ShopItemDescriptor { - money16 Cost; - money16 BaseValue; - money16 HotValue; - money16 ColdValue; - money8 DefaultPrice; + money64 Cost; + money64 BaseValue; + money64 HotValue; + money64 ColdValue; + money64 DefaultPrice; uint32_t Image; ShopItemStrings Naming; uint16_t Flags; @@ -130,7 +130,7 @@ enum extern uint64_t gSamePriceThroughoutPark; -money32 ShopItemGetCommonPrice(Ride* forRide, const ShopItem shopItem); +money64 ShopItemGetCommonPrice(Ride* forRide, const ShopItem shopItem); bool ShopItemHasCommonPrice(const ShopItem shopItem); const ShopItemDescriptor& GetShopItemDescriptor(ShopItem item); diff --git a/src/openrct2/ride/TrackData.cpp b/src/openrct2/ride/TrackData.cpp index 1743f1fc86..75bc46b980 100644 --- a/src/openrct2/ride/TrackData.cpp +++ b/src/openrct2/ride/TrackData.cpp @@ -4172,7 +4172,7 @@ static constexpr track_type_t AlternativeTrackTypes[TrackElemType::Count] = { }; /** rct2: 0x0099DA34 */ -static constexpr money32 TrackPricing[TrackElemType::Count] = { +static constexpr money64 TrackPricing[TrackElemType::Count] = { 65536, // TrackElemType::Flat 98304, // TrackElemType::EndStation 98304, // TrackElemType::BeginStation diff --git a/src/openrct2/ride/TrackDesign.cpp b/src/openrct2/ride/TrackDesign.cpp index 5356ac19bb..3ed1129d3f 100644 --- a/src/openrct2/ride/TrackDesign.cpp +++ b/src/openrct2/ride/TrackDesign.cpp @@ -1055,7 +1055,7 @@ static GameActions::Result TrackDesignPlaceSceneryElement( return GameActions::Result(); } - money32 cost = 0; + money64 cost = 0; if (tds.PlaceOperation != PTD_OPERATION_PLACE_QUERY && tds.PlaceOperation != PTD_OPERATION_PLACE && tds.PlaceOperation != PTD_OPERATION_PLACE_GHOST && tds.PlaceOperation != PTD_OPERATION_PLACE_TRACK_PREVIEW) @@ -1310,7 +1310,7 @@ static GameActions::Result TrackDesignPlaceAllScenery( { const auto& origin = tds.Origin; - money32 cost = 0; + money64 cost = 0; for (uint8_t mode = 0; mode <= 1; mode++) { @@ -1359,7 +1359,7 @@ static GameActions::Result TrackDesignPlaceMaze( } tds.PlaceZ = 0; - money32 totalCost = 0; + money64 totalCost = 0; for (const auto& maze_element : td6->maze_elements) { @@ -1379,7 +1379,7 @@ static GameActions::Result TrackDesignPlaceMaze( || tds.PlaceOperation == PTD_OPERATION_PLACE_GHOST || tds.PlaceOperation == PTD_OPERATION_PLACE_TRACK_PREVIEW) { uint8_t flags; - money32 cost = 0; + money64 cost = 0; uint16_t maze_entry; switch (maze_element.type) { @@ -1573,7 +1573,7 @@ static GameActions::Result TrackDesignPlaceRide(TrackDesignState& tds, TrackDesi } tds.PlaceZ = 0; - money32 totalCost = 0; + money64 totalCost = 0; uint8_t rotation = _currentTrackPieceDirection; // Track elements @@ -1958,7 +1958,7 @@ int32_t TrackDesignGetZPlacement(TrackDesign* td6, Ride& ride, const CoordsXYZD& return TrackDesignGetZPlacement(tds, td6, ride, coords); } -static money32 TrackDesignCreateRide(int32_t type, int32_t subType, int32_t flags, RideId* outRideIndex) +static money64 TrackDesignCreateRide(int32_t type, int32_t subType, int32_t flags, RideId* outRideIndex) { // Don't set colours as will be set correctly later. auto gameAction = RideCreateAction(type, subType, 0, 0, gLastEntranceStyle); @@ -1966,10 +1966,10 @@ static money32 TrackDesignCreateRide(int32_t type, int32_t subType, int32_t flag auto res = GameActions::ExecuteNested(&gameAction); - // Callee's of this function expect MONEY32_UNDEFINED in case of failure. + // Callee's of this function expect MONEY64_UNDEFINED in case of failure. if (res.Error != GameActions::Status::Ok) { - return MONEY32_UNDEFINED; + return MONEY64_UNDEFINED; } *outRideIndex = res.GetData(); @@ -1983,7 +1983,7 @@ static money32 TrackDesignCreateRide(int32_t type, int32_t subType, int32_t flag * ebx = ride_id * cost = edi */ -static bool TrackDesignPlacePreview(TrackDesignState& tds, TrackDesign* td6, money32* cost, Ride** outRide, uint8_t* flags) +static bool TrackDesignPlacePreview(TrackDesignState& tds, TrackDesign* td6, money64* cost, Ride** outRide, uint8_t* flags) { *outRide = nullptr; *flags = 0; @@ -1993,7 +1993,7 @@ static bool TrackDesignPlacePreview(TrackDesignState& tds, TrackDesign* td6, mon RideId rideIndex; uint8_t rideCreateFlags = GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_NO_SPEND; - if (TrackDesignCreateRide(td6->type, entry_index, rideCreateFlags, &rideIndex) == MONEY32_UNDEFINED) + if (TrackDesignCreateRide(td6->type, entry_index, rideCreateFlags, &rideIndex) == MONEY64_UNDEFINED) { return false; } @@ -2099,7 +2099,7 @@ void TrackDesignDrawPreview(TrackDesign* td6, uint8_t* pixels) TrackDesignState tds{}; - money32 cost; + money64 cost; Ride* ride; uint8_t flags; if (!TrackDesignPlacePreview(tds, td6, &cost, &ride, &flags)) diff --git a/src/openrct2/ride/TrackDesign.h b/src/openrct2/ride/TrackDesign.h index 4dd7389a62..f5c3d0c2ce 100644 --- a/src/openrct2/ride/TrackDesign.h +++ b/src/openrct2/ride/TrackDesign.h @@ -103,7 +103,7 @@ struct TrackDesign { uint8_t type; uint8_t vehicle_type; - money32 cost; + money64 cost; uint32_t flags; RideMode ride_mode; uint8_t track_flags; @@ -130,7 +130,7 @@ struct TrackDesign uint8_t excitement; uint8_t intensity; uint8_t nausea; - money16 upkeep_cost; + money64 upkeep_cost; uint8_t track_spine_colour[RCT12::Limits::NumColourSchemes]; uint8_t track_rail_colour[RCT12::Limits::NumColourSchemes]; uint8_t track_support_colour[RCT12::Limits::NumColourSchemes]; diff --git a/src/openrct2/ride/gentle/Maze.cpp b/src/openrct2/ride/gentle/Maze.cpp index 2a315f3994..50a4502f53 100644 --- a/src/openrct2/ride/gentle/Maze.cpp +++ b/src/openrct2/ride/gentle/Maze.cpp @@ -200,7 +200,7 @@ TRACK_PAINT_FUNCTION GetTrackPaintFunctionMaze(int32_t trackType) return MazePaintSetup; } -money64 MazeCalculateCost(money32 constructionCost, const Ride& ride, const CoordsXYZ& loc) +money64 MazeCalculateCost(money64 constructionCost, const Ride& ride, const CoordsXYZ& loc) { const auto& ted = GetTrackElementDescriptor(TrackElemType::Maze); money64 price = (ride.GetRideTypeDescriptor().BuildCosts.TrackPrice * ted.PriceModifier) >> 16; diff --git a/src/openrct2/ride/gentle/Maze.h b/src/openrct2/ride/gentle/Maze.h index 814ed94d3f..b5db6bf6f4 100644 --- a/src/openrct2/ride/gentle/Maze.h +++ b/src/openrct2/ride/gentle/Maze.h @@ -11,4 +11,4 @@ #include "../RideData.h" -money64 MazeCalculateCost(money32 constructionCost, const Ride& ride, const CoordsXYZ& loc); +money64 MazeCalculateCost(money64 constructionCost, const Ride& ride, const CoordsXYZ& loc); diff --git a/src/openrct2/scenario/Scenario.cpp b/src/openrct2/scenario/Scenario.cpp index 113790a089..c12712f6a6 100644 --- a/src/openrct2/scenario/Scenario.cpp +++ b/src/openrct2/scenario/Scenario.cpp @@ -638,8 +638,8 @@ ObjectiveStatus Objective::CheckGuestsBy() const ObjectiveStatus Objective::CheckParkValueBy() const { int32_t currentMonthYear = gDateMonthsElapsed; - money32 objectiveParkValue = Currency; - money32 parkValue = gParkValue; + money64 objectiveParkValue = Currency; + money64 parkValue = gParkValue; if (currentMonthYear == MONTH_COUNT * Year || AllowEarlyCompletion()) { @@ -748,7 +748,7 @@ ObjectiveStatus Objective::CheckGuestsAndRating() const ObjectiveStatus Objective::CheckMonthlyRideIncome() const { - money32 lastMonthRideIncome = gExpenditureTable[1][static_cast(ExpenditureType::ParkRideTickets)]; + money64 lastMonthRideIncome = gExpenditureTable[1][static_cast(ExpenditureType::ParkRideTickets)]; if (lastMonthRideIncome >= Currency) { return ObjectiveStatus::Success; @@ -822,8 +822,8 @@ ObjectiveStatus Objective::CheckFinish5RollerCoasters() const ObjectiveStatus Objective::CheckRepayLoanAndParkValue() const { - money32 parkValue = gParkValue; - money32 currentLoan = gBankLoan; + money64 parkValue = gParkValue; + money64 currentLoan = gBankLoan; if (currentLoan <= 0 && parkValue >= Currency) { diff --git a/src/openrct2/scripting/ScriptEngine.cpp b/src/openrct2/scripting/ScriptEngine.cpp index 3aaa6b82ce..02eae57bc3 100644 --- a/src/openrct2/scripting/ScriptEngine.cpp +++ b/src/openrct2/scripting/ScriptEngine.cpp @@ -1161,7 +1161,7 @@ DukValue ScriptEngine::GameActionResultToDuk(const GameAction& action, const Gam obj.Set("errorMessage", result.GetErrorMessage()); } - if (result.Cost != MONEY32_UNDEFINED) + if (result.Cost != MONEY64_UNDEFINED) { obj.Set("cost", result.Cost); } diff --git a/src/openrct2/scripting/bindings/ride/ScRide.cpp b/src/openrct2/scripting/bindings/ride/ScRide.cpp index f454925c22..acfc3a2b21 100644 --- a/src/openrct2/scripting/bindings/ride/ScRide.cpp +++ b/src/openrct2/scripting/bindings/ride/ScRide.cpp @@ -325,7 +325,7 @@ namespace OpenRCT2::Scripting auto numPrices = std::min(value.size(), ride->GetNumPrices()); for (size_t i = 0; i < numPrices; i++) { - ride->price[i] = static_cast(value[i]); + ride->price[i] = static_cast(value[i]); } } } @@ -411,12 +411,12 @@ namespace OpenRCT2::Scripting return ride != nullptr ? ride->GetAge() : 0; } - int16_t ScRide::runningCost_get() const + money64 ScRide::runningCost_get() const { auto ride = GetRide(); return ride != nullptr ? ride->upkeep_cost : 0; } - void ScRide::runningCost_set(int16_t value) + void ScRide::runningCost_set(money64 value) { ThrowIfGameStateNotMutable(); auto ride = GetRide(); diff --git a/src/openrct2/scripting/bindings/ride/ScRide.hpp b/src/openrct2/scripting/bindings/ride/ScRide.hpp index 92a41adf51..396087b2d9 100644 --- a/src/openrct2/scripting/bindings/ride/ScRide.hpp +++ b/src/openrct2/scripting/bindings/ride/ScRide.hpp @@ -142,8 +142,8 @@ namespace OpenRCT2::Scripting int32_t age_get() const; - int16_t runningCost_get() const; - void runningCost_set(int16_t value); + money64 runningCost_get() const; + void runningCost_set(money64 value); int32_t totalProfit_get() const; void totalProfit_set(int32_t value); diff --git a/src/openrct2/scripting/bindings/world/ScPark.cpp b/src/openrct2/scripting/bindings/world/ScPark.cpp index 7a7ab950e3..aba155c0fe 100644 --- a/src/openrct2/scripting/bindings/world/ScPark.cpp +++ b/src/openrct2/scripting/bindings/world/ScPark.cpp @@ -109,11 +109,11 @@ namespace OpenRCT2::Scripting } } - money16 ScPark::entranceFee_get() const + money64 ScPark::entranceFee_get() const { return gParkEntranceFee; } - void ScPark::entranceFee_set(money16 value) + void ScPark::entranceFee_set(money64 value) { ThrowIfGameStateNotMutable(); @@ -139,7 +139,7 @@ namespace OpenRCT2::Scripting return _guestGenerationProbability; } - money16 ScPark::guestInitialCash_get() const + money64 ScPark::guestInitialCash_get() const { return gGuestInitialCash; } @@ -226,21 +226,21 @@ namespace OpenRCT2::Scripting } } - money32 ScPark::landPrice_get() const + money64 ScPark::landPrice_get() const { return gLandPrice; } - void ScPark::landPrice_set(money32 value) + void ScPark::landPrice_set(money64 value) { ThrowIfGameStateNotMutable(); gLandPrice = value; } - money32 ScPark::constructionRightsPrice_get() const + money64 ScPark::constructionRightsPrice_get() const { return gConstructionRightsPrice; } - void ScPark::constructionRightsPrice_set(money32 value) + void ScPark::constructionRightsPrice_set(money64 value) { ThrowIfGameStateNotMutable(); gConstructionRightsPrice = value; diff --git a/src/openrct2/scripting/bindings/world/ScPark.hpp b/src/openrct2/scripting/bindings/world/ScPark.hpp index db17323e7d..439a2539ea 100644 --- a/src/openrct2/scripting/bindings/world/ScPark.hpp +++ b/src/openrct2/scripting/bindings/world/ScPark.hpp @@ -36,8 +36,8 @@ namespace OpenRCT2::Scripting money64 maxBankLoan_get() const; void maxBankLoan_set(money64 value); - money16 entranceFee_get() const; - void entranceFee_set(money16 value); + money64 entranceFee_get() const; + void entranceFee_set(money64 value); uint32_t guests_get() const; @@ -45,7 +45,7 @@ namespace OpenRCT2::Scripting int32_t guestGenerationProbability_get() const; - money16 guestInitialCash_get() const; + money64 guestInitialCash_get() const; uint8_t guestInitialHappiness_get() const; @@ -67,11 +67,11 @@ namespace OpenRCT2::Scripting money64 totalIncomeFromAdmissions_get() const; void totalIncomeFromAdmissions_set(money64 value); - money32 landPrice_get() const; - void landPrice_set(money32 value); + money64 landPrice_get() const; + void landPrice_set(money64 value); - money32 constructionRightsPrice_get() const; - void constructionRightsPrice_set(money32 value); + money64 constructionRightsPrice_get() const; + void constructionRightsPrice_set(money64 value); int16_t casualtyPenalty_get() const; void casualtyPenalty_set(int16_t value); diff --git a/src/openrct2/util/Util.cpp b/src/openrct2/util/Util.cpp index 2413d4d06c..72828aa2e2 100644 --- a/src/openrct2/util/Util.cpp +++ b/src/openrct2/util/Util.cpp @@ -546,22 +546,6 @@ int64_t AddClamp_int64_t(int64_t value, int64_t value_to_add) return value; } -money16 AddClamp_money16(money16 value, money16 value_to_add) -{ - // This function is intended only for clarity, as money16 - // is technically the same as int16_t - assert_struct_size(money16, sizeof(int16_t)); - return AddClamp_int16_t(value, value_to_add); -} - -money32 AddClamp_money32(money32 value, money32 value_to_add) -{ - // This function is intended only for clarity, as money32 - // is technically the same as int32_t - assert_struct_size(money32, sizeof(int32_t)); - return AddClamp_int32_t(value, value_to_add); -} - money64 AddClamp_money64(money64 value, money64 value_to_add) { // This function is intended only for clarity, as money64 diff --git a/src/openrct2/util/Util.h b/src/openrct2/util/Util.h index 38f5b1d70f..5ec8b7e6fb 100644 --- a/src/openrct2/util/Util.h +++ b/src/openrct2/util/Util.h @@ -46,8 +46,6 @@ int8_t AddClamp_int8_t(int8_t value, int8_t value_to_add); int16_t AddClamp_int16_t(int16_t value, int16_t value_to_add); int32_t AddClamp_int32_t(int32_t value, int32_t value_to_add); int64_t AddClamp_int64_t(int64_t value, int64_t value_to_add); -money16 AddClamp_money16(money16 value, money16 value_to_add); -money32 AddClamp_money32(money32 value, money32 value_to_add); money64 AddClamp_money64(money64 value, money64 value_to_add); uint8_t Lerp(uint8_t a, uint8_t b, float t); diff --git a/src/openrct2/windows/_legacy.cpp b/src/openrct2/windows/_legacy.cpp index cb79db58e6..2b977c85b6 100644 --- a/src/openrct2/windows/_legacy.cpp +++ b/src/openrct2/windows/_legacy.cpp @@ -39,12 +39,12 @@ RideConstructionState _rideConstructionState2; * * rct2: 0x006CA162 */ -money32 PlaceProvisionalTrackPiece( +money64 PlaceProvisionalTrackPiece( RideId rideIndex, int32_t trackType, int32_t trackDirection, int32_t liftHillAndAlternativeState, const CoordsXYZ& trackPos) { auto ride = GetRide(rideIndex); if (ride == nullptr) - return MONEY32_UNDEFINED; + return MONEY64_UNDEFINED; RideConstructionRemoveGhosts(); const auto& rtd = ride->GetRideTypeDescriptor(); @@ -56,7 +56,7 @@ money32 PlaceProvisionalTrackPiece( auto result = GameActions::Execute(&gameAction); if (result.Error != GameActions::Status::Ok) - return MONEY32_UNDEFINED; + return MONEY64_UNDEFINED; _unkF440C5 = { trackPos, static_cast(trackDirection) }; _currentTrackSelectionFlags |= TRACK_SELECTION_FLAG_TRACK; @@ -83,7 +83,7 @@ money32 PlaceProvisionalTrackPiece( // This command must not be sent over the network auto res = GameActions::Execute(&trackPlaceAction); if (res.Error != GameActions::Status::Ok) - return MONEY32_UNDEFINED; + return MONEY64_UNDEFINED; int16_t z_begin, z_end; const auto& ted = GetTrackElementDescriptor(trackType); diff --git a/src/openrct2/world/ConstructionClearance.cpp b/src/openrct2/world/ConstructionClearance.cpp index 047063b762..966477dbdd 100644 --- a/src/openrct2/world/ConstructionClearance.cpp +++ b/src/openrct2/world/ConstructionClearance.cpp @@ -22,7 +22,7 @@ #include "Surface.h" static int32_t MapPlaceClearFunc( - TileElement** tile_element, const CoordsXY& coords, uint8_t flags, money32* price, bool is_scenery) + TileElement** tile_element, const CoordsXY& coords, uint8_t flags, money64* price, bool is_scenery) { if ((*tile_element)->GetType() != TileElementType::SmallScenery) return 1; @@ -59,7 +59,7 @@ static int32_t MapPlaceClearFunc( * * rct2: 0x006E0D6E, 0x006B8D88 */ -int32_t MapPlaceSceneryClearFunc(TileElement** tile_element, const CoordsXY& coords, uint8_t flags, money32* price) +int32_t MapPlaceSceneryClearFunc(TileElement** tile_element, const CoordsXY& coords, uint8_t flags, money64* price) { return MapPlaceClearFunc(tile_element, coords, flags, price, /*is_scenery=*/true); } @@ -68,13 +68,13 @@ int32_t MapPlaceSceneryClearFunc(TileElement** tile_element, const CoordsXY& coo * * rct2: 0x006C5A4F, 0x006CDE57, 0x006A6733, 0x0066637E */ -int32_t MapPlaceNonSceneryClearFunc(TileElement** tile_element, const CoordsXY& coords, uint8_t flags, money32* price) +int32_t MapPlaceNonSceneryClearFunc(TileElement** tile_element, const CoordsXY& coords, uint8_t flags, money64* price) { return MapPlaceClearFunc(tile_element, coords, flags, price, /*is_scenery=*/false); } static bool MapLoc68BABCShouldContinue( - TileElement** tileElementPtr, const CoordsXYRangedZ& pos, CLEAR_FUNC clearFunc, uint8_t flags, money32& price, + TileElement** tileElementPtr, const CoordsXYRangedZ& pos, CLEAR_FUNC clearFunc, uint8_t flags, money64& price, uint8_t crossingMode, bool canBuildCrossing) { if (clearFunc != nullptr) diff --git a/src/openrct2/world/ConstructionClearance.h b/src/openrct2/world/ConstructionClearance.h index ec4b259322..3c68a92f09 100644 --- a/src/openrct2/world/ConstructionClearance.h +++ b/src/openrct2/world/ConstructionClearance.h @@ -20,10 +20,10 @@ struct CoordsXY; struct CoordsXYRangedZ; class QuarterTile; -using CLEAR_FUNC = int32_t (*)(TileElement** tile_element, const CoordsXY& coords, uint8_t flags, money32* price); +using CLEAR_FUNC = int32_t (*)(TileElement** tile_element, const CoordsXY& coords, uint8_t flags, money64* price); -int32_t MapPlaceNonSceneryClearFunc(TileElement** tile_element, const CoordsXY& coords, uint8_t flags, money32* price); -int32_t MapPlaceSceneryClearFunc(TileElement** tile_element, const CoordsXY& coords, uint8_t flags, money32* price); +int32_t MapPlaceNonSceneryClearFunc(TileElement** tile_element, const CoordsXY& coords, uint8_t flags, money64* price); +int32_t MapPlaceSceneryClearFunc(TileElement** tile_element, const CoordsXY& coords, uint8_t flags, money64* price); struct ConstructClearResult { diff --git a/src/openrct2/world/Entrance.cpp b/src/openrct2/world/Entrance.cpp index 29a85c938e..7d4a621ada 100644 --- a/src/openrct2/world/Entrance.cpp +++ b/src/openrct2/world/Entrance.cpp @@ -39,7 +39,7 @@ std::vector gParkEntrances; CoordsXYZD gRideEntranceExitGhostPosition; StationIndex gRideEntranceExitGhostStationIndex; -static money32 RideEntranceExitPlaceGhost( +static money64 RideEntranceExitPlaceGhost( RideId rideIndex, const CoordsXY& entranceExitCoords, Direction direction, uint8_t placeType, StationIndex stationNum) { auto rideEntranceExitPlaceAction = RideEntranceExitPlaceAction( @@ -47,7 +47,7 @@ static money32 RideEntranceExitPlaceGhost( rideEntranceExitPlaceAction.SetFlags(GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_GHOST); auto res = GameActions::Execute(&rideEntranceExitPlaceAction); - return res.Error == GameActions::Status::Ok ? res.Cost : MONEY32_UNDEFINED; + return res.Error == GameActions::Status::Ok ? res.Cost : MONEY64_UNDEFINED; } /** @@ -111,13 +111,13 @@ void RideEntranceExitRemoveGhost() * * rct2: 0x006CA28C */ -money32 RideEntranceExitPlaceGhost( +money64 RideEntranceExitPlaceGhost( const Ride& ride, const CoordsXY& entranceExitCoords, Direction direction, int32_t placeType, StationIndex stationNum) { RideConstructionRemoveGhosts(); - money32 result = RideEntranceExitPlaceGhost(ride.id, entranceExitCoords, direction, placeType, stationNum); + money64 result = RideEntranceExitPlaceGhost(ride.id, entranceExitCoords, direction, placeType, stationNum); - if (result != MONEY32_UNDEFINED) + if (result != MONEY64_UNDEFINED) { _currentTrackSelectionFlags |= TRACK_SELECTION_FLAG_ENTRANCE_OR_EXIT; gRideEntranceExitGhostPosition.x = entranceExitCoords.x; diff --git a/src/openrct2/world/Footpath.cpp b/src/openrct2/world/Footpath.cpp index 225be81f97..43b7c6b325 100644 --- a/src/openrct2/world/Footpath.cpp +++ b/src/openrct2/world/Footpath.cpp @@ -137,18 +137,18 @@ TileElement* MapGetFootpathElement(const CoordsXYZ& coords) * * rct2: 0x006A76FF */ -money32 FootpathProvisionalSet( +money64 FootpathProvisionalSet( ObjectEntryIndex type, ObjectEntryIndex railingsType, const CoordsXYZ& footpathLoc, int32_t slope, PathConstructFlags constructFlags) { - money32 cost; + money64 cost; FootpathProvisionalRemove(); auto footpathPlaceAction = FootpathPlaceAction(footpathLoc, slope, type, railingsType, INVALID_DIRECTION, constructFlags); footpathPlaceAction.SetFlags(GAME_COMMAND_FLAG_GHOST | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED); auto res = GameActions::Execute(&footpathPlaceAction); - cost = res.Error == GameActions::Status::Ok ? res.Cost : MONEY32_UNDEFINED; + cost = res.Error == GameActions::Status::Ok ? res.Cost : MONEY64_UNDEFINED; if (res.Error == GameActions::Status::Ok) { gProvisionalFootpath.SurfaceIndex = type; diff --git a/src/openrct2/world/Footpath.h b/src/openrct2/world/Footpath.h index 6d26872a34..751d616cf9 100644 --- a/src/openrct2/world/Footpath.h +++ b/src/openrct2/world/Footpath.h @@ -185,7 +185,7 @@ extern const CoordsXY BenchUseOffsets[NumOrthogonalDirections * 2]; TileElement* MapGetFootpathElement(const CoordsXYZ& coords); void FootpathInterruptPeeps(const CoordsXYZ& footpathPos); -money32 FootpathProvisionalSet( +money64 FootpathProvisionalSet( ObjectEntryIndex type, ObjectEntryIndex railingsType, const CoordsXYZ& footpathLoc, int32_t slope, PathConstructFlags constructFlags); void FootpathProvisionalRemove(); diff --git a/src/openrct2/world/Park.cpp b/src/openrct2/world/Park.cpp index fe0af56711..6ab312379b 100644 --- a/src/openrct2/world/Park.cpp +++ b/src/openrct2/world/Park.cpp @@ -48,10 +48,10 @@ using namespace OpenRCT2; uint64_t gParkFlags; uint16_t gParkRating; -money16 gParkEntranceFee; +money64 gParkEntranceFee; uint32_t gParkSize; -money16 gLandPrice; -money16 gConstructionRightsPrice; +money64 gLandPrice; +money64 gConstructionRightsPrice; uint64_t gTotalAdmissions; money64 gTotalIncomeFromAdmissions; @@ -191,7 +191,7 @@ int32_t ParkGetForcedRating() return _forcedParkRating; } -money16 ParkGetEntranceFee() +money64 ParkGetEntranceFee() { if (gParkFlags & PARK_FLAGS_NO_MONEY) { @@ -500,8 +500,7 @@ money64 Park::CalculateRideValue(const Ride& ride) const if (ride.value != RIDE_VALUE_UNDEFINED) { const auto& rtd = ride.GetRideTypeDescriptor(); - result = ToMoney64FromGBP(ride.value) - * (static_cast(RideCustomersInLast5Minutes(ride)) + rtd.BonusValue * 4LL); + result = (ride.value * 10) * (static_cast(RideCustomersInLast5Minutes(ride)) + rtd.BonusValue * 4LL); } return result; } @@ -532,7 +531,7 @@ money64 Park::CalculateTotalRideValueForMoney() const // Add ride value if (ride.value != RIDE_VALUE_UNDEFINED) { - money64 rideValue = static_cast(ride.value); + money64 rideValue = ride.value; if (ridePricesUnlocked) { rideValue -= ride.price[0]; @@ -616,7 +615,7 @@ uint32_t Park::CalculateGuestGenerationProbability() const } // Penalty for overpriced entrance fee relative to total ride value - money16 entranceFee = ParkGetEntranceFee(); + auto entranceFee = ParkGetEntranceFee(); if (entranceFee > gTotalRideValueForMoney) { probability /= 4; diff --git a/src/openrct2/world/Park.h b/src/openrct2/world/Park.h index 5c6496d8c2..10b9b2686c 100644 --- a/src/openrct2/world/Park.h +++ b/src/openrct2/world/Park.h @@ -94,10 +94,10 @@ namespace OpenRCT2 extern uint64_t gParkFlags; extern uint16_t gParkRating; -extern money16 gParkEntranceFee; +extern money64 gParkEntranceFee; extern uint32_t gParkSize; -extern money16 gLandPrice; -extern money16 gConstructionRightsPrice; +extern money64 gLandPrice; +extern money64 gConstructionRightsPrice; extern uint64_t gTotalAdmissions; extern money64 gTotalIncomeFromAdmissions; @@ -124,7 +124,7 @@ uint8_t CalculateGuestInitialHappiness(uint8_t percentage); void ParkSetOpen(bool open); int32_t ParkEntranceGetIndex(const CoordsXYZ& entrancePos); -money16 ParkGetEntranceFee(); +money64 ParkGetEntranceFee(); bool ParkRidePricesUnlocked(); bool ParkEntranceFeeUnlocked(); diff --git a/src/openrct2/world/Scenery.cpp b/src/openrct2/world/Scenery.cpp index b164056b60..3c42d31931 100644 --- a/src/openrct2/world/Scenery.cpp +++ b/src/openrct2/world/Scenery.cpp @@ -41,7 +41,7 @@ uint8_t gSceneryQuadrant; -money32 gSceneryPlaceCost; +money64 gSceneryPlaceCost; ScenerySelection gSceneryPlaceObject; int16_t gSceneryPlaceZ; uint8_t gSceneryPlaceRotation; diff --git a/src/openrct2/world/Scenery.h b/src/openrct2/world/Scenery.h index b7d4227a7a..793c817671 100644 --- a/src/openrct2/world/Scenery.h +++ b/src/openrct2/world/Scenery.h @@ -47,7 +47,7 @@ enum class ScatterToolDensity : uint8_t extern uint8_t gSceneryQuadrant; -extern money32 gSceneryPlaceCost; +extern money64 gSceneryPlaceCost; extern ScenerySelection gSceneryPlaceObject; extern int16_t gSceneryPlaceZ; extern uint8_t gSceneryPlaceRotation;