1
0
Fork 0

Feature: Setting to allow bulldozing unserved industries

pull/13265/head
Tyler Trahan 2025-01-03 15:35:14 -05:00
parent cb18cb5832
commit 4d23dccaca
5 changed files with 33 additions and 1 deletions

View File

@ -493,13 +493,33 @@ static CommandCost ClearTile_Industry(TileIndex tile, DoCommandFlag flags)
Industry *i = Industry::GetByTile(tile); Industry *i = Industry::GetByTile(tile);
const IndustrySpec *indspec = GetIndustrySpec(i->type); const IndustrySpec *indspec = GetIndustrySpec(i->type);
/* Check if the player can bulldoze the industry. */
bool bulldoze_allowed = _settings_game.construction.bulldoze_industries;
if (bulldoze_allowed) {
/* Don't bulldoze industries that have recently had any cargo transported...*/
for (const auto &p : i->produced) {
if (p.history[LAST_MONTH].PctTransported() > 0) {
bulldoze_allowed = false;
break;
}
}
/* ...or received. */
for (const auto &a : i->accepted) {
if (a.last_accepted + EconomyTime::DAYS_IN_ECONOMY_YEAR > TimerGameEconomy::date) {
bulldoze_allowed = false;
break;
}
}
}
/* water can destroy industries /* water can destroy industries
* in editor you can bulldoze industries * in editor you can bulldoze industries
* with magic_bulldozer cheat you can destroy industries * with magic_bulldozer cheat you can destroy industries
* (area around OILRIG is water, so water shouldn't flood it * (area around OILRIG is water, so water shouldn't flood it
*/ */
if ((_current_company != OWNER_WATER && _game_mode != GM_EDITOR && if ((_current_company != OWNER_WATER && _game_mode != GM_EDITOR &&
!_cheats.magic_bulldozer.value) || !bulldoze_allowed) ||
((flags & DC_AUTO) != 0) || ((flags & DC_AUTO) != 0) ||
(_current_company == OWNER_WATER && (_current_company == OWNER_WATER &&
((indspec->behaviour & INDUSTRYBEH_BUILT_ONWATER) || ((indspec->behaviour & INDUSTRYBEH_BUILT_ONWATER) ||

View File

@ -1395,6 +1395,9 @@ STR_CONFIG_SETTING_INDUSTRY_PLATFORM_HELPTEXT :Amount of flat
STR_CONFIG_SETTING_MULTIPINDTOWN :Allow multiple similar industries per town: {STRING2} STR_CONFIG_SETTING_MULTIPINDTOWN :Allow multiple similar industries per town: {STRING2}
STR_CONFIG_SETTING_MULTIPINDTOWN_HELPTEXT :Normally, a town does not want more than one industry of each type. With this setting, it will allow several industries of the same type in the same town STR_CONFIG_SETTING_MULTIPINDTOWN_HELPTEXT :Normally, a town does not want more than one industry of each type. With this setting, it will allow several industries of the same type in the same town
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_SIGNALSIDE :Show signals: {STRING2} STR_CONFIG_SETTING_SIGNALSIDE :Show signals: {STRING2}
STR_CONFIG_SETTING_SIGNALSIDE_HELPTEXT :Select on which side of the track to place signals STR_CONFIG_SETTING_SIGNALSIDE_HELPTEXT :Select on which side of the track to place signals
###length 3 ###length 3

View File

@ -2149,6 +2149,7 @@ static SettingsContainer &GetSettingsTree()
limitations->Add(new SettingEntry("construction.command_pause_level")); limitations->Add(new SettingEntry("construction.command_pause_level"));
limitations->Add(new SettingEntry("construction.autoslope")); limitations->Add(new SettingEntry("construction.autoslope"));
limitations->Add(new SettingEntry("construction.extra_dynamite")); limitations->Add(new SettingEntry("construction.extra_dynamite"));
limitations->Add(new SettingEntry("construction.bulldoze_industries"));
limitations->Add(new SettingEntry("construction.map_height_limit")); limitations->Add(new SettingEntry("construction.map_height_limit"));
limitations->Add(new SettingEntry("construction.max_bridge_length")); limitations->Add(new SettingEntry("construction.max_bridge_length"));
limitations->Add(new SettingEntry("construction.max_bridge_height")); limitations->Add(new SettingEntry("construction.max_bridge_height"));

View File

@ -392,6 +392,7 @@ struct ConstructionSettings {
bool crossing_with_competitor; ///< allow building of level crossings with competitor roads or rails bool crossing_with_competitor; ///< allow building of level crossings with competitor roads or rails
uint8_t raw_industry_construction; ///< type of (raw) industry construction (none, "normal", prospecting) 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 uint8_t industry_platform; ///< the amount of flat land around an industry
bool bulldoze_industries; ///< whether players can bulldozed unserved industries
bool freeform_edges; ///< allow terraforming the tiles at the map edges 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 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 uint8_t command_pause_level; ///< level/amount of commands that can't be executed while paused

View File

@ -560,6 +560,13 @@ strhelp = STR_CONFIG_SETTING_INDUSTRY_PLATFORM_HELPTEXT
strval = STR_CONFIG_SETTING_TILE_LENGTH strval = STR_CONFIG_SETTING_TILE_LENGTH
cat = SC_EXPERT cat = SC_EXPERT
[SDT_BOOL]
var = construction.bulldoze_industries
def = false
str = STR_CONFIG_SETTING_BULLDOZE_INDUSTRIES
strhelp = STR_CONFIG_SETTING_BULLDOZE_INDUSTRIES_HELPTEXT
cat = SC_BASIC
[SDT_BOOL] [SDT_BOOL]
var = construction.freeform_edges var = construction.freeform_edges
from = SLV_111 from = SLV_111