diff --git a/src/town_type.h b/src/town_type.h index dec057d44a..d23d9910de 100644 --- a/src/town_type.h +++ b/src/town_type.h @@ -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, diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp index 90f962d376..78d07707cb 100644 --- a/src/water_cmd.cpp +++ b/src/water_cmd.cpp @@ -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);