mirror of https://github.com/OpenTTD/OpenTTD
Feature: Setting to allow bulldozing unserved industries
parent
cb18cb5832
commit
4d23dccaca
|
@ -493,13 +493,33 @@ static CommandCost ClearTile_Industry(TileIndex tile, DoCommandFlag flags)
|
|||
Industry *i = Industry::GetByTile(tile);
|
||||
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
|
||||
* in editor you can bulldoze industries
|
||||
* with magic_bulldozer cheat you can destroy industries
|
||||
* (area around OILRIG is water, so water shouldn't flood it
|
||||
*/
|
||||
if ((_current_company != OWNER_WATER && _game_mode != GM_EDITOR &&
|
||||
!_cheats.magic_bulldozer.value) ||
|
||||
!bulldoze_allowed) ||
|
||||
((flags & DC_AUTO) != 0) ||
|
||||
(_current_company == OWNER_WATER &&
|
||||
((indspec->behaviour & INDUSTRYBEH_BUILT_ONWATER) ||
|
||||
|
|
|
@ -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_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_HELPTEXT :Select on which side of the track to place signals
|
||||
###length 3
|
||||
|
|
|
@ -2149,6 +2149,7 @@ static SettingsContainer &GetSettingsTree()
|
|||
limitations->Add(new SettingEntry("construction.command_pause_level"));
|
||||
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.map_height_limit"));
|
||||
limitations->Add(new SettingEntry("construction.max_bridge_length"));
|
||||
limitations->Add(new SettingEntry("construction.max_bridge_height"));
|
||||
|
|
|
@ -392,6 +392,7 @@ struct ConstructionSettings {
|
|||
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 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
|
||||
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
|
||||
|
|
|
@ -560,6 +560,13 @@ strhelp = STR_CONFIG_SETTING_INDUSTRY_PLATFORM_HELPTEXT
|
|||
strval = STR_CONFIG_SETTING_TILE_LENGTH
|
||||
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]
|
||||
var = construction.freeform_edges
|
||||
from = SLV_111
|
||||
|
|
Loading…
Reference in New Issue