mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-19 21:13:05 +01:00
Fix #9067 - Prices rendering in unlimited money game state
This commit is contained in:
committed by
Michael Steenbeek
parent
cdf587080c
commit
82c73e18c7
@@ -13,6 +13,7 @@
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/localisation/Localisation.h>
|
||||
#include <openrct2/world/Park.h>
|
||||
#include <openrct2/world/Scenery.h>
|
||||
|
||||
// clang-format off
|
||||
@@ -244,10 +245,10 @@ static void window_clear_scenery_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
}
|
||||
|
||||
// Draw cost amount
|
||||
x = (window_clear_scenery_widgets[WIDX_PREVIEW].left + window_clear_scenery_widgets[WIDX_PREVIEW].right) / 2 + w->x;
|
||||
y = window_clear_scenery_widgets[WIDX_PREVIEW].bottom + w->y + 5 + 27;
|
||||
if (gClearSceneryCost != MONEY32_UNDEFINED && gClearSceneryCost != 0)
|
||||
if (gClearSceneryCost != MONEY32_UNDEFINED && gClearSceneryCost != 0 && !(gParkFlags & PARK_FLAGS_NO_MONEY))
|
||||
{
|
||||
x = (window_clear_scenery_widgets[WIDX_PREVIEW].left + window_clear_scenery_widgets[WIDX_PREVIEW].right) / 2 + w->x;
|
||||
y = window_clear_scenery_widgets[WIDX_PREVIEW].bottom + w->y + 5 + 27;
|
||||
gfx_draw_string_centred(dpi, STR_COST_AMOUNT, x, y, COLOUR_BLACK, &gClearSceneryCost);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -360,35 +360,39 @@ static void window_land_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
x = w->x + (previewWidget->left + previewWidget->right) / 2;
|
||||
y = w->y + previewWidget->bottom + 5;
|
||||
|
||||
// Draw raise cost amount
|
||||
if (gLandToolRaiseCost != MONEY32_UNDEFINED && gLandToolRaiseCost != 0)
|
||||
gfx_draw_string_centred(dpi, STR_RAISE_COST_AMOUNT, x, y, COLOUR_BLACK, &gLandToolRaiseCost);
|
||||
y += 10;
|
||||
|
||||
// Draw lower cost amount
|
||||
if (gLandToolLowerCost != MONEY32_UNDEFINED && gLandToolLowerCost != 0)
|
||||
gfx_draw_string_centred(dpi, STR_LOWER_COST_AMOUNT, x, y, COLOUR_BLACK, &gLandToolLowerCost);
|
||||
y += 50;
|
||||
|
||||
// Draw paint price
|
||||
numTiles = gLandToolSize * gLandToolSize;
|
||||
price = 0;
|
||||
if (gLandToolTerrainSurface != 255)
|
||||
if (!(gParkFlags & PARK_FLAGS_NO_MONEY))
|
||||
{
|
||||
auto& objManager = GetContext()->GetObjectManager();
|
||||
const auto surfaceObj = static_cast<TerrainSurfaceObject*>(
|
||||
objManager.GetLoadedObject(OBJECT_TYPE_TERRAIN_SURFACE, gLandToolTerrainSurface));
|
||||
if (surfaceObj != nullptr)
|
||||
// Draw raise cost amount
|
||||
if (gLandToolRaiseCost != MONEY32_UNDEFINED && gLandToolRaiseCost != 0)
|
||||
gfx_draw_string_centred(dpi, STR_RAISE_COST_AMOUNT, x, y, COLOUR_BLACK, &gLandToolRaiseCost);
|
||||
y += 10;
|
||||
|
||||
// Draw lower cost amount
|
||||
if (gLandToolLowerCost != MONEY32_UNDEFINED && gLandToolLowerCost != 0)
|
||||
gfx_draw_string_centred(dpi, STR_LOWER_COST_AMOUNT, x, y, COLOUR_BLACK, &gLandToolLowerCost);
|
||||
y += 50;
|
||||
|
||||
// Draw paint price
|
||||
numTiles = gLandToolSize * gLandToolSize;
|
||||
price = 0;
|
||||
if (gLandToolTerrainSurface != 255)
|
||||
{
|
||||
price += numTiles * surfaceObj->Price;
|
||||
auto& objManager = GetContext()->GetObjectManager();
|
||||
const auto surfaceObj = static_cast<TerrainSurfaceObject*>(
|
||||
objManager.GetLoadedObject(OBJECT_TYPE_TERRAIN_SURFACE, gLandToolTerrainSurface));
|
||||
if (surfaceObj != nullptr)
|
||||
{
|
||||
price += numTiles * surfaceObj->Price;
|
||||
}
|
||||
}
|
||||
|
||||
if (gLandToolTerrainEdge != 255)
|
||||
price += numTiles * 100;
|
||||
|
||||
if (price != 0)
|
||||
{
|
||||
set_format_arg(0, money32, price);
|
||||
gfx_draw_string_centred(dpi, STR_COST_AMOUNT, x, y, COLOUR_BLACK, gCommonFormatArgs);
|
||||
}
|
||||
}
|
||||
if (gLandToolTerrainEdge != 255)
|
||||
price += numTiles * 100;
|
||||
|
||||
if (price != 0 && !(gParkFlags & PARK_FLAGS_NO_MONEY))
|
||||
{
|
||||
set_format_arg(0, money32, price);
|
||||
gfx_draw_string_centred(dpi, STR_COST_AMOUNT, x, y, COLOUR_BLACK, gCommonFormatArgs);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -281,10 +281,10 @@ static void window_land_rights_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
}
|
||||
|
||||
// Draw cost amount
|
||||
x = (window_land_rights_widgets[WIDX_PREVIEW].left + window_land_rights_widgets[WIDX_PREVIEW].right) / 2 + w->x;
|
||||
y = window_land_rights_widgets[WIDX_PREVIEW].bottom + w->y + 32;
|
||||
if (_landRightsCost != MONEY32_UNDEFINED && _landRightsCost != 0)
|
||||
if (_landRightsCost != MONEY32_UNDEFINED && _landRightsCost != 0 && !(gParkFlags & PARK_FLAGS_NO_MONEY))
|
||||
{
|
||||
x = (window_land_rights_widgets[WIDX_PREVIEW].left + window_land_rights_widgets[WIDX_PREVIEW].right) / 2 + w->x;
|
||||
y = window_land_rights_widgets[WIDX_PREVIEW].bottom + w->y + 32;
|
||||
gfx_draw_string_centred(dpi, STR_COST_AMOUNT, x, y, COLOUR_BLACK, &_landRightsCost);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/drawing/Drawing.h>
|
||||
#include <openrct2/localisation/Localisation.h>
|
||||
#include <openrct2/world/Park.h>
|
||||
|
||||
// clang-format off
|
||||
enum WINDOW_WATER_WIDGET_IDX {
|
||||
@@ -220,14 +221,17 @@ static void window_water_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
gfx_draw_string_centred(dpi, STR_LAND_TOOL_SIZE_VALUE, x, y - 2, COLOUR_BLACK, &gLandToolSize);
|
||||
}
|
||||
|
||||
// Draw raise cost amount
|
||||
x = (window_water_widgets[WIDX_PREVIEW].left + window_water_widgets[WIDX_PREVIEW].right) / 2 + w->x;
|
||||
y = window_water_widgets[WIDX_PREVIEW].bottom + w->y + 5;
|
||||
if (gWaterToolRaiseCost != MONEY32_UNDEFINED && gWaterToolRaiseCost != 0)
|
||||
gfx_draw_string_centred(dpi, STR_RAISE_COST_AMOUNT, x, y, COLOUR_BLACK, &gWaterToolRaiseCost);
|
||||
y += 10;
|
||||
if (!(gParkFlags & PARK_FLAGS_NO_MONEY))
|
||||
{
|
||||
// Draw raise cost amount
|
||||
x = (window_water_widgets[WIDX_PREVIEW].left + window_water_widgets[WIDX_PREVIEW].right) / 2 + w->x;
|
||||
y = window_water_widgets[WIDX_PREVIEW].bottom + w->y + 5;
|
||||
if (gWaterToolRaiseCost != MONEY32_UNDEFINED && gWaterToolRaiseCost != 0)
|
||||
gfx_draw_string_centred(dpi, STR_RAISE_COST_AMOUNT, x, y, COLOUR_BLACK, &gWaterToolRaiseCost);
|
||||
y += 10;
|
||||
|
||||
// Draw lower cost amount
|
||||
if (gWaterToolLowerCost != MONEY32_UNDEFINED && gWaterToolLowerCost != 0)
|
||||
gfx_draw_string_centred(dpi, STR_LOWER_COST_AMOUNT, x, y, COLOUR_BLACK, &gWaterToolLowerCost);
|
||||
// Draw lower cost amount
|
||||
if (gWaterToolLowerCost != MONEY32_UNDEFINED && gWaterToolLowerCost != 0)
|
||||
gfx_draw_string_centred(dpi, STR_LOWER_COST_AMOUNT, x, y, COLOUR_BLACK, &gWaterToolLowerCost);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user