From b564013ca116a88c5dcf3f192ac083289bfacb39 Mon Sep 17 00:00:00 2001 From: Tyler Trahan Date: Fri, 3 Jan 2025 15:35:35 -0500 Subject: [PATCH] Feature: Setting to allow bulldozing immovable objects --- src/lang/english.txt | 3 +++ src/object_cmd.cpp | 6 +++--- src/settings_gui.cpp | 1 + src/settings_type.h | 1 + src/table/settings/world_settings.ini | 7 +++++++ 5 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/lang/english.txt b/src/lang/english.txt index b8e4f3e3d5..b17a06089c 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -1398,6 +1398,9 @@ STR_CONFIG_SETTING_MULTIPINDTOWN_HELPTEXT :Normally, a tow STR_CONFIG_SETTING_BULLDOZE_INDUSTRIES :Allow bulldozing unserved industries STR_CONFIG_SETTING_BULLDOZE_INDUSTRIES_HELPTEXT :Allow industries to be demolished if 0% of their output is currently being transported +STR_CONFIG_SETTING_BULLDOZE_OBJECTS :Allow bulldozing immovable objects +STR_CONFIG_SETTING_BULLDOZE_OBJECTS_HELPTEXT :Allow lighthouses, transmitters, and NewGRF objects to be demolished + STR_CONFIG_SETTING_SIGNALSIDE :Show signals: {STRING2} STR_CONFIG_SETTING_SIGNALSIDE_HELPTEXT :Select on which side of the track to place signals ###length 3 diff --git a/src/object_cmd.cpp b/src/object_cmd.cpp index d4f28477b9..59b8fed6c9 100644 --- a/src/object_cmd.cpp +++ b/src/object_cmd.cpp @@ -566,13 +566,13 @@ static CommandCost ClearTile_Object(TileIndex tile, DoCommandFlag flags) /* No further limitations for the editor. */ } else if (GetTileOwner(tile) == OWNER_NONE) { /* Owned by nobody and unremovable, so we can only remove it with brute force! */ - if (!_cheats.magic_bulldozer.value && (spec->flags & OBJECT_FLAG_CANNOT_REMOVE) != 0) return CMD_ERROR; + if (!_settings_game.construction.bulldoze_objects && (spec->flags & OBJECT_FLAG_CANNOT_REMOVE) != 0) return CMD_ERROR; } else if (CheckTileOwnership(tile).Failed()) { /* We don't own it!. */ return CommandCost(STR_ERROR_OWNED_BY); } else if ((spec->flags & OBJECT_FLAG_CANNOT_REMOVE) != 0 && (spec->flags & OBJECT_FLAG_AUTOREMOVE) == 0) { - /* In the game editor or with cheats we can remove, otherwise we can't. */ - if (!_cheats.magic_bulldozer.value) { + /* We might be allowed to remove immovable objects. */ + if (!_settings_game.construction.bulldoze_objects) { if (type == OBJECT_HQ) return CommandCost(STR_ERROR_COMPANY_HEADQUARTERS_IN); return CMD_ERROR; } diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index 9ff5aa7970..0576fab441 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -2150,6 +2150,7 @@ static SettingsContainer &GetSettingsTree() limitations->Add(new SettingEntry("construction.autoslope")); limitations->Add(new SettingEntry("construction.extra_dynamite")); limitations->Add(new SettingEntry("construction.bulldoze_industries")); + limitations->Add(new SettingEntry("construction.bulldoze_objects")); limitations->Add(new SettingEntry("construction.map_height_limit")); limitations->Add(new SettingEntry("construction.max_bridge_length")); limitations->Add(new SettingEntry("construction.max_bridge_height")); diff --git a/src/settings_type.h b/src/settings_type.h index 6a06c4f7dc..481e064fb3 100644 --- a/src/settings_type.h +++ b/src/settings_type.h @@ -393,6 +393,7 @@ struct ConstructionSettings { uint8_t raw_industry_construction; ///< type of (raw) industry construction (none, "normal", prospecting) uint8_t industry_platform; ///< the amount of flat land around an industry bool bulldoze_industries; ///< whether players can bulldozed unserved industries + bool bulldoze_objects; ///< whether objects can be bulldozed, even if immovable bool freeform_edges; ///< allow terraforming the tiles at the map edges uint8_t extra_tree_placement; ///< (dis)allow building extra trees in-game uint8_t command_pause_level; ///< level/amount of commands that can't be executed while paused diff --git a/src/table/settings/world_settings.ini b/src/table/settings/world_settings.ini index 5331dfcd94..15fc7e6122 100644 --- a/src/table/settings/world_settings.ini +++ b/src/table/settings/world_settings.ini @@ -567,6 +567,13 @@ str = STR_CONFIG_SETTING_BULLDOZE_INDUSTRIES strhelp = STR_CONFIG_SETTING_BULLDOZE_INDUSTRIES_HELPTEXT cat = SC_BASIC +[SDT_BOOL] +var = construction.bulldoze_objects +def = false +str = STR_CONFIG_SETTING_BULLDOZE_OBJECTS +strhelp = STR_CONFIG_SETTING_BULLDOZE_OBJECTS_HELPTEXT +cat = SC_BASIC + [SDT_BOOL] var = construction.freeform_edges from = SLV_111