1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-02-02 17:11:20 +01:00

Change: Removing river tiles reduce local authority rating

This commit is contained in:
Richard Wheeler
2026-01-28 10:06:56 +00:00
parent fb8d4e880e
commit 637f4ad5a6
2 changed files with 13 additions and 0 deletions

View File

@@ -77,6 +77,9 @@ static constexpr int RATING_BRIBE_UP_STEP = 200;
static constexpr int RATING_BRIBE_MAXIMUM = 800;
static constexpr int RATING_BRIBE_DOWN_TO = -50; // XXX SHOULD BE SOMETHING LOWER?
static constexpr int RATING_WATER_RIVER_DOWN_STEP = -200; ///< removing a river tile
static constexpr int RATING_WATER_MINIMUM = RATING_MINIMUM; ///< minimum rating after removing water features near town
/** Town Layouts. It needs to be 8bits, because we save and load it as such */
enum TownLayout : uint8_t {
TL_BEGIN = 0,

View File

@@ -40,6 +40,7 @@
#include "water_cmd.h"
#include "landscape_cmd.h"
#include "pathfinder/water_regions.h"
#include "town_type.h"
#include "table/strings.h"
@@ -597,6 +598,15 @@ static CommandCost ClearTile_Water(TileIndex tile, DoCommandFlags flags)
Company::Get(owner)->infrastructure.water--;
DirtyCompanyInfrastructureWindows(owner);
}
/* Handle local authority impact */
if (IsRiver(tile)) {
if (Company::IsValidID(_current_company)) {
Town *town = ClosestTownFromTile(tile, _settings_game.economy.dist_local_authority);
if (town != nullptr) ChangeTownRating(town, RATING_WATER_RIVER_DOWN_STEP, RATING_WATER_MINIMUM, flags);
}
}
DoClearSquare(tile);
MarkCanalsAndRiversAroundDirty(tile);
ClearNeighbourNonFloodingStates(tile);