1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-23 06:44:38 +01:00

LandSetRightsAction: calculate cost based on buying/selling rights

This commit is contained in:
Aaron van Geffen
2024-08-05 17:35:00 +02:00
parent 087af9889b
commit 4fb673d0b9
3 changed files with 28 additions and 2 deletions

View File

@@ -6,6 +6,7 @@
- Feature: [#22414] Finance graphs can be resized.
- Change: [#21659] Increase the Hybrid Roller Coasters maximum lift speed to 17 km/h (11 mph).
- Change: [#22466] The Clear Scenery tool now uses a bulldozer cursor instead of a generic crosshair.
- Change: [#22490] In sandbox mode, changing land or construction rights now acts as buying or selling.
- Change: [#22491] Scrollbars are now hidden if the scrollable widget is not actually overflowing.
- Fix: [#21908] Errors showing up when placing/moving track design previews.
- Fix: [#22307] Hover tooltips in financial charts are not invalidated properly.

View File

@@ -185,7 +185,32 @@ GameActions::Result LandSetRightsAction::MapBuyLandRightsForTile(const CoordsXY&
}
auto& gameState = GetGameState();
res.Cost = gameState.LandPrice;
const uint8_t currentOwnership = surfaceElement->GetOwnership();
// Are land rights or construction rights currently owned?
if (!(currentOwnership & (OWNERSHIP_OWNED | OWNERSHIP_CONSTRUCTION_RIGHTS_OWNED)))
{
// Buying land
if (!(currentOwnership & OWNERSHIP_OWNED) && (_ownership & OWNERSHIP_OWNED))
res.Cost = gameState.LandPrice;
// Buying construction rights
if (!(currentOwnership & OWNERSHIP_CONSTRUCTION_RIGHTS_OWNED)
&& (_ownership & OWNERSHIP_CONSTRUCTION_RIGHTS_OWNED))
res.Cost = gameState.ConstructionRightsPrice;
}
else
{
// Selling land
if ((currentOwnership & OWNERSHIP_OWNED) && !(_ownership & OWNERSHIP_OWNED))
res.Cost = -gameState.LandPrice;
// Selling construction rights
if ((currentOwnership & OWNERSHIP_CONSTRUCTION_RIGHTS_OWNED)
&& !(_ownership & OWNERSHIP_CONSTRUCTION_RIGHTS_OWNED))
res.Cost = -gameState.ConstructionRightsPrice;
}
if (isExecuting)
{
if (_ownership != OWNERSHIP_UNOWNED)

View File

@@ -49,7 +49,7 @@ using namespace OpenRCT2;
// It is used for making sure only compatible builds get connected, even within
// single OpenRCT2 version.
constexpr uint8_t kNetworkStreamVersion = 2;
constexpr uint8_t kNetworkStreamVersion = 3;
const std::string kNetworkStreamID = std::string(OPENRCT2_VERSION) + "-" + std::to_string(kNetworkStreamVersion);