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:
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user