diff --git a/src/openrct2-ui/interface/LandTool.cpp b/src/openrct2-ui/interface/LandTool.cpp index 4019c4486d..8301bd02ed 100644 --- a/src/openrct2-ui/interface/LandTool.cpp +++ b/src/openrct2-ui/interface/LandTool.cpp @@ -37,12 +37,12 @@ static uint16_t toolSizeSpriteIndices[] = // clang-format on uint16_t gLandToolSize; -money32 gLandToolRaiseCost; -money32 gLandToolLowerCost; +money64 gLandToolRaiseCost; +money64 gLandToolLowerCost; ObjectEntryIndex gLandToolTerrainSurface; ObjectEntryIndex gLandToolTerrainEdge; -money32 gWaterToolRaiseCost; -money32 gWaterToolLowerCost; +money64 gWaterToolRaiseCost; +money64 gWaterToolLowerCost; uint32_t LandTool::SizeToSpriteIndex(uint16_t size) { diff --git a/src/openrct2-ui/interface/LandTool.h b/src/openrct2-ui/interface/LandTool.h index c851ef7838..7dd689d0fa 100644 --- a/src/openrct2-ui/interface/LandTool.h +++ b/src/openrct2-ui/interface/LandTool.h @@ -19,12 +19,12 @@ #define MAX_TOOL_SIZE_WITH_SPRITE 7 extern uint16_t gLandToolSize; -extern money32 gLandToolRaiseCost; -extern money32 gLandToolLowerCost; +extern money64 gLandToolRaiseCost; +extern money64 gLandToolLowerCost; extern ObjectEntryIndex gLandToolTerrainSurface; extern ObjectEntryIndex gLandToolTerrainEdge; -extern money32 gWaterToolRaiseCost; -extern money32 gWaterToolLowerCost; +extern money64 gWaterToolRaiseCost; +extern money64 gWaterToolLowerCost; namespace LandTool { diff --git a/src/openrct2-ui/windows/Land.cpp b/src/openrct2-ui/windows/Land.cpp index b53097bcde..ed9a67a473 100644 --- a/src/openrct2-ui/windows/Land.cpp +++ b/src/openrct2-ui/windows/Land.cpp @@ -81,8 +81,8 @@ public: gLandPaintMode = false; _selectedFloorTexture = 0; _selectedWallTexture = 0; - gLandToolRaiseCost = MONEY32_UNDEFINED; - gLandToolLowerCost = MONEY32_UNDEFINED; + gLandToolRaiseCost = MONEY64_UNDEFINED; + gLandToolLowerCost = MONEY64_UNDEFINED; } void OnClose() override @@ -283,7 +283,7 @@ public: if (!(gParkFlags & PARK_FLAGS_NO_MONEY)) { // Draw raise cost amount - if (gLandToolRaiseCost != MONEY32_UNDEFINED && gLandToolRaiseCost != 0) + if (gLandToolRaiseCost != MONEY64_UNDEFINED && gLandToolRaiseCost != 0) { auto ft = Formatter(); ft.Add(gLandToolRaiseCost); @@ -292,7 +292,7 @@ public: screenCoords.y += 10; // Draw lower cost amount - if (gLandToolLowerCost != MONEY32_UNDEFINED && gLandToolLowerCost != 0) + if (gLandToolLowerCost != MONEY64_UNDEFINED && gLandToolLowerCost != 0) { auto ft = Formatter(); ft.Add(gLandToolLowerCost); diff --git a/src/openrct2-ui/windows/TopToolbar.cpp b/src/openrct2-ui/windows/TopToolbar.cpp index 3124475c7e..62368c5da4 100644 --- a/src/openrct2-ui/windows/TopToolbar.cpp +++ b/src/openrct2-ui/windows/TopToolbar.cpp @@ -308,8 +308,8 @@ static void toggle_land_window(rct_window* topToolbar, rct_widgetindex widgetInd static void toggle_clear_scenery_window(rct_window* topToolbar, rct_widgetindex widgetIndex); static void toggle_water_window(rct_window* topToolbar, rct_widgetindex widgetIndex); -static money32 selection_lower_land(uint8_t flags); -static money32 selection_raise_land(uint8_t flags); +static money64 selection_lower_land(uint8_t flags); +static money64 selection_raise_land(uint8_t flags); static ClearAction GetClearAction(); @@ -2092,8 +2092,8 @@ static void top_toolbar_tool_update_land(const ScreenCoordsXY& screenPos) if (!(gMapSelectFlags & MAP_SELECT_FLAG_ENABLE)) return; - money32 lower_cost = selection_lower_land(0); - money32 raise_cost = selection_raise_land(0); + money64 lower_cost = selection_lower_land(0); + money64 raise_cost = selection_raise_land(0); if (gLandToolRaiseCost != raise_cost || gLandToolLowerCost != lower_cost) { @@ -2118,8 +2118,8 @@ static void top_toolbar_tool_update_land(const ScreenCoordsXY& screenPos) if (!mapTile) { - money32 lower_cost = MONEY32_UNDEFINED; - money32 raise_cost = MONEY32_UNDEFINED; + money64 lower_cost = MONEY64_UNDEFINED; + money64 raise_cost = MONEY64_UNDEFINED; if (gLandToolRaiseCost != raise_cost || gLandToolLowerCost != lower_cost) { @@ -2178,8 +2178,8 @@ static void top_toolbar_tool_update_land(const ScreenCoordsXY& screenPos) if (!state_changed) return; - money32 lower_cost = selection_lower_land(0); - money32 raise_cost = selection_raise_land(0); + money64 lower_cost = selection_lower_land(0); + money64 raise_cost = selection_raise_land(0); if (gLandToolRaiseCost != raise_cost || gLandToolLowerCost != lower_cost) { @@ -2195,8 +2195,8 @@ static void top_toolbar_tool_update_land(const ScreenCoordsXY& screenPos) if (!mapTile) { - money32 lower_cost = MONEY32_UNDEFINED; - money32 raise_cost = MONEY32_UNDEFINED; + money64 lower_cost = MONEY64_UNDEFINED; + money64 raise_cost = MONEY64_UNDEFINED; if (gLandToolRaiseCost != raise_cost || gLandToolLowerCost != lower_cost) { @@ -2304,8 +2304,8 @@ static void top_toolbar_tool_update_land(const ScreenCoordsXY& screenPos) if (!state_changed) return; - money32 lower_cost = selection_lower_land(0); - money32 raise_cost = selection_raise_land(0); + money64 lower_cost = selection_lower_land(0); + money64 raise_cost = selection_raise_land(0); if (gLandToolRaiseCost != raise_cost || gLandToolLowerCost != lower_cost) { @@ -2334,10 +2334,10 @@ static void top_toolbar_tool_update_water(const ScreenCoordsXY& screenPos) { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }); auto res = GameActions::Query(&waterLowerAction); - money32 lowerCost = res->Error == GameActions::Status::Ok ? res->Cost : MONEY32_UNDEFINED; + money64 lowerCost = res->Error == GameActions::Status::Ok ? res->Cost : MONEY64_UNDEFINED; res = GameActions::Query(&waterRaiseAction); - money32 raiseCost = res->Error == GameActions::Status::Ok ? res->Cost : MONEY32_UNDEFINED; + money64 raiseCost = res->Error == GameActions::Status::Ok ? res->Cost : MONEY64_UNDEFINED; if (gWaterToolRaiseCost != raiseCost || gWaterToolLowerCost != lowerCost) { @@ -2355,10 +2355,10 @@ static void top_toolbar_tool_update_water(const ScreenCoordsXY& screenPos) if (info.SpriteType == ViewportInteractionItem::None) { - if (gWaterToolRaiseCost != MONEY32_UNDEFINED || gWaterToolLowerCost != MONEY32_UNDEFINED) + if (gWaterToolRaiseCost != MONEY64_UNDEFINED || gWaterToolLowerCost != MONEY64_UNDEFINED) { - gWaterToolRaiseCost = MONEY32_UNDEFINED; - gWaterToolLowerCost = MONEY32_UNDEFINED; + gWaterToolRaiseCost = MONEY64_UNDEFINED; + gWaterToolLowerCost = MONEY64_UNDEFINED; window_invalidate_by_class(WC_WATER); } return; @@ -2426,10 +2426,10 @@ static void top_toolbar_tool_update_water(const ScreenCoordsXY& screenPos) { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }); auto res = GameActions::Query(&waterLowerAction); - money32 lowerCost = res->Error == GameActions::Status::Ok ? res->Cost : MONEY32_UNDEFINED; + money64 lowerCost = res->Error == GameActions::Status::Ok ? res->Cost : MONEY64_UNDEFINED; res = GameActions::Query(&waterRaiseAction); - money32 raiseCost = res->Error == GameActions::Status::Ok ? res->Cost : MONEY32_UNDEFINED; + money64 raiseCost = res->Error == GameActions::Status::Ok ? res->Cost : MONEY64_UNDEFINED; if (gWaterToolRaiseCost != raiseCost || gWaterToolLowerCost != lowerCost) { @@ -2442,10 +2442,10 @@ static void top_toolbar_tool_update_water(const ScreenCoordsXY& screenPos) /** * * rct2: 0x006E24F6 - * On failure returns MONEY32_UNDEFINED + * On failure returns MONEY64_UNDEFINED * On success places ghost scenery and returns cost to place proper */ -static money32 try_place_ghost_small_scenery( +static money64 try_place_ghost_small_scenery( CoordsXYZD loc, uint8_t quadrant, ObjectEntryIndex entryIndex, colour_t primaryColour, colour_t secondaryColour) { scenery_remove_ghost_tool_placement(); @@ -2456,7 +2456,7 @@ static money32 try_place_ghost_small_scenery( auto res = GameActions::Execute(&smallSceneryPlaceAction); auto sspar = dynamic_cast(res.get()); if (sspar == nullptr || res->Error != GameActions::Status::Ok) - return MONEY32_UNDEFINED; + return MONEY64_UNDEFINED; gSceneryPlaceRotation = loc.direction; gSceneryPlaceObject.SceneryType = SCENERY_TYPE_SMALL; @@ -2480,7 +2480,7 @@ static money32 try_place_ghost_small_scenery( return res->Cost; } -static money32 try_place_ghost_path_addition(CoordsXYZ loc, ObjectEntryIndex entryIndex) +static money64 try_place_ghost_path_addition(CoordsXYZ loc, ObjectEntryIndex entryIndex) { scenery_remove_ghost_tool_placement(); @@ -2497,12 +2497,12 @@ static money32 try_place_ghost_path_addition(CoordsXYZ loc, ObjectEntryIndex ent }); auto res = GameActions::Execute(&footpathAdditionPlaceAction); if (res->Error != GameActions::Status::Ok) - return MONEY32_UNDEFINED; + return MONEY64_UNDEFINED; return res->Cost; } -static money32 try_place_ghost_wall( +static money64 try_place_ghost_wall( CoordsXYZ loc, uint8_t edge, ObjectEntryIndex entryIndex, colour_t primaryColour, colour_t secondaryColour, colour_t tertiaryColour) { @@ -2523,12 +2523,12 @@ static money32 try_place_ghost_wall( auto res = GameActions::Execute(&wallPlaceAction); if (res->Error != GameActions::Status::Ok) - return MONEY32_UNDEFINED; + return MONEY64_UNDEFINED; return res->Cost; } -static money32 try_place_ghost_large_scenery( +static money64 try_place_ghost_large_scenery( CoordsXYZD loc, ObjectEntryIndex entryIndex, colour_t primaryColour, colour_t secondaryColour) { scenery_remove_ghost_tool_placement(); @@ -2539,7 +2539,7 @@ static money32 try_place_ghost_large_scenery( auto res = GameActions::Execute(&sceneryPlaceAction); auto lspar = dynamic_cast(res.get()); if (lspar == nullptr || res->Error != GameActions::Status::Ok) - return MONEY32_UNDEFINED; + return MONEY64_UNDEFINED; gSceneryPlaceRotation = loc.direction; @@ -2559,7 +2559,7 @@ static money32 try_place_ghost_large_scenery( return res->Cost; } -static money32 try_place_ghost_banner(CoordsXYZD loc, ObjectEntryIndex entryIndex) +static money64 try_place_ghost_banner(CoordsXYZD loc, ObjectEntryIndex entryIndex) { scenery_remove_ghost_tool_placement(); @@ -2569,7 +2569,7 @@ static money32 try_place_ghost_banner(CoordsXYZD loc, ObjectEntryIndex entryInde bannerPlaceAction.SetFlags(GAME_COMMAND_FLAG_GHOST | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_NO_SPEND); auto res = GameActions::Execute(&bannerPlaceAction); if (res->Error != GameActions::Status::Ok) - return MONEY32_UNDEFINED; + return MONEY64_UNDEFINED; gSceneryGhostPosition = loc; gSceneryGhostPosition.z += PATH_HEIGHT_STEP; @@ -2608,7 +2608,7 @@ static void top_toolbar_tool_update_scenery(const ScreenCoordsXY& screenPos) return; } - money32 cost = 0; + money64 cost = 0; switch (selection.SceneryType) { @@ -2683,7 +2683,7 @@ static void top_toolbar_tool_update_scenery(const ScreenCoordsXY& screenPos) { mapTile, gSceneryPlaceZ, rotation }, quadrant, selection.EntryIndex, gWindowSceneryPrimaryColour, gWindowScenerySecondaryColour); - if (cost != MONEY32_UNDEFINED) + if (cost != MONEY64_UNDEFINED) break; gSceneryPlaceZ += 8; } @@ -2773,7 +2773,7 @@ static void top_toolbar_tool_update_scenery(const ScreenCoordsXY& screenPos) { mapTile, gSceneryPlaceZ }, edge, selection.EntryIndex, gWindowSceneryPrimaryColour, gWindowScenerySecondaryColour, gWindowSceneryTertiaryColour); - if (cost != MONEY32_UNDEFINED) + if (cost != MONEY64_UNDEFINED) break; gSceneryPlaceZ += 8; } @@ -2839,7 +2839,7 @@ static void top_toolbar_tool_update_scenery(const ScreenCoordsXY& screenPos) { mapTile, gSceneryPlaceZ, direction }, selection.EntryIndex, gWindowSceneryPrimaryColour, gWindowScenerySecondaryColour); - if (cost != MONEY32_UNDEFINED) + if (cost != MONEY64_UNDEFINED) break; gSceneryPlaceZ += COORDS_Z_STEP; } @@ -2983,7 +2983,7 @@ static void window_top_toolbar_tool_down(rct_window* w, rct_widgetindex widgetIn * * rct2: 0x006644DD */ -static money32 selection_raise_land(uint8_t flags) +static money64 selection_raise_land(uint8_t flags) { int32_t centreX = (gMapSelectPositionA.x + gMapSelectPositionB.x) / 2; int32_t centreY = (gMapSelectPositionA.y + gMapSelectPositionB.y) / 2; @@ -2998,7 +2998,7 @@ static money32 selection_raise_land(uint8_t flags) false); auto res = (flags & GAME_COMMAND_FLAG_APPLY) ? GameActions::Execute(&landSmoothAction) : GameActions::Query(&landSmoothAction); - return res->Error == GameActions::Status::Ok ? res->Cost : MONEY32_UNDEFINED; + return res->Error == GameActions::Status::Ok ? res->Cost : MONEY64_UNDEFINED; } else { @@ -3008,7 +3008,7 @@ static money32 selection_raise_land(uint8_t flags) auto res = (flags & GAME_COMMAND_FLAG_APPLY) ? GameActions::Execute(&landRaiseAction) : GameActions::Query(&landRaiseAction); - return res->Error == GameActions::Status::Ok ? res->Cost : MONEY32_UNDEFINED; + return res->Error == GameActions::Status::Ok ? res->Cost : MONEY64_UNDEFINED; } } @@ -3016,7 +3016,7 @@ static money32 selection_raise_land(uint8_t flags) * * rct2: 0x006645B3 */ -static money32 selection_lower_land(uint8_t flags) +static money64 selection_lower_land(uint8_t flags) { int32_t centreX = (gMapSelectPositionA.x + gMapSelectPositionB.x) / 2; int32_t centreY = (gMapSelectPositionA.y + gMapSelectPositionB.y) / 2; @@ -3031,7 +3031,7 @@ static money32 selection_lower_land(uint8_t flags) true); auto res = (flags & GAME_COMMAND_FLAG_APPLY) ? GameActions::Execute(&landSmoothAction) : GameActions::Query(&landSmoothAction); - return res->Error == GameActions::Status::Ok ? res->Cost : MONEY32_UNDEFINED; + return res->Error == GameActions::Status::Ok ? res->Cost : MONEY64_UNDEFINED; } else { @@ -3041,7 +3041,7 @@ static money32 selection_lower_land(uint8_t flags) auto res = (flags & GAME_COMMAND_FLAG_APPLY) ? GameActions::Execute(&landLowerAction) : GameActions::Query(&landLowerAction); - return res->Error == GameActions::Status::Ok ? res->Cost : MONEY32_UNDEFINED; + return res->Error == GameActions::Status::Ok ? res->Cost : MONEY64_UNDEFINED; } } @@ -3074,8 +3074,8 @@ static void window_top_toolbar_land_tool_drag(const ScreenCoordsXY& screenPos) selection_raise_land(GAME_COMMAND_FLAG_APPLY); - gLandToolRaiseCost = MONEY32_UNDEFINED; - gLandToolLowerCost = MONEY32_UNDEFINED; + gLandToolRaiseCost = MONEY64_UNDEFINED; + gLandToolLowerCost = MONEY64_UNDEFINED; } else if (y_diff >= -tile_height) { @@ -3083,8 +3083,8 @@ static void window_top_toolbar_land_tool_drag(const ScreenCoordsXY& screenPos) selection_lower_land(GAME_COMMAND_FLAG_APPLY); - gLandToolRaiseCost = MONEY32_UNDEFINED; - gLandToolLowerCost = MONEY32_UNDEFINED; + gLandToolRaiseCost = MONEY64_UNDEFINED; + gLandToolLowerCost = MONEY64_UNDEFINED; } } @@ -3119,8 +3119,8 @@ static void window_top_toolbar_water_tool_drag(const ScreenCoordsXY& screenPos) { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }); GameActions::Execute(&waterRaiseAction); - gWaterToolRaiseCost = MONEY32_UNDEFINED; - gWaterToolLowerCost = MONEY32_UNDEFINED; + gWaterToolRaiseCost = MONEY64_UNDEFINED; + gWaterToolLowerCost = MONEY64_UNDEFINED; return; } @@ -3134,8 +3134,8 @@ static void window_top_toolbar_water_tool_drag(const ScreenCoordsXY& screenPos) auto waterLowerAction = WaterLowerAction( { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }); GameActions::Execute(&waterLowerAction); - gWaterToolRaiseCost = MONEY32_UNDEFINED; - gWaterToolLowerCost = MONEY32_UNDEFINED; + gWaterToolRaiseCost = MONEY64_UNDEFINED; + gWaterToolLowerCost = MONEY64_UNDEFINED; return; } diff --git a/src/openrct2-ui/windows/Water.cpp b/src/openrct2-ui/windows/Water.cpp index fe64fdb6da..d841579ac9 100644 --- a/src/openrct2-ui/windows/Water.cpp +++ b/src/openrct2-ui/windows/Water.cpp @@ -51,8 +51,8 @@ public: window_push_others_below(this); gLandToolSize = 1; - gWaterToolRaiseCost = MONEY32_UNDEFINED; - gWaterToolLowerCost = MONEY32_UNDEFINED; + gWaterToolRaiseCost = MONEY64_UNDEFINED; + gWaterToolLowerCost = MONEY64_UNDEFINED; } void OnClose() override @@ -156,7 +156,7 @@ public: // Draw raise cost amount screenCoords = { window_water_widgets[WIDX_PREVIEW].midX() + windowPos.x, window_water_widgets[WIDX_PREVIEW].bottom + windowPos.y + 5 }; - if (gWaterToolRaiseCost != MONEY32_UNDEFINED && gWaterToolRaiseCost != 0) + if (gWaterToolRaiseCost != MONEY64_UNDEFINED && gWaterToolRaiseCost != 0) { auto ft = Formatter(); ft.Add(gWaterToolRaiseCost); @@ -165,7 +165,7 @@ public: screenCoords.y += 10; // Draw lower cost amount - if (gWaterToolLowerCost != MONEY32_UNDEFINED && gWaterToolLowerCost != 0) + if (gWaterToolLowerCost != MONEY64_UNDEFINED && gWaterToolLowerCost != 0) { auto ft = Formatter(); ft.Add(gWaterToolLowerCost);