From c4494faf10592b85c2ca8f9c23f7b8ab3b95d07e Mon Sep 17 00:00:00 2001 From: Michael Ostapenko Date: Fri, 11 Oct 2024 02:31:43 +1100 Subject: [PATCH] Fix #12968, d20df82: Added back ability to create unremovable houses --- src/town_cmd.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index 204268d1e6..40c497d66e 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -728,10 +728,17 @@ static CommandCost ClearTile_Town(TileIndex tile, DoCommandFlag flags) Town *t = Town::GetByTile(tile); if (Company::IsValidID(_current_company)) { - if (rating > t->ratings[_current_company] && !(flags & DC_NO_TEST_TOWN_RATING) && - !_cheats.magic_bulldozer.value && _settings_game.difficulty.town_council_tolerance != TOWN_COUNCIL_PERMISSIVE) { - SetDParam(0, t->index); - return CommandCost(STR_ERROR_LOCAL_AUTHORITY_REFUSES_TO_ALLOW_THIS); + if (!_cheats.magic_bulldozer.value && !(flags & DC_NO_TEST_TOWN_RATING)) { + /* NewGRFs can add indestructible houses. */ + if (rating > RATING_MAXIMUM) { + SetDParam(0, t->index); + return CommandCost(CMD_ERROR); + } + /* If town authority controls removal, check the company's rating. */ + if (rating > t->ratings[_current_company] && _settings_game.difficulty.town_council_tolerance != TOWN_COUNCIL_PERMISSIVE) { + SetDParam(0, t->index); + return CommandCost(STR_ERROR_LOCAL_AUTHORITY_REFUSES_TO_ALLOW_THIS); + } } }