Add setting for demolition confirmation mode
This commit is contained in:
@@ -1453,6 +1453,12 @@ STR_CONFIG_SETTING_VEHICLE_NAMES_LONG :Long
|
||||
STR_CONFIG_SETTING_SHADED_TREES_ON_SLOPES :Shade trees on slopes: {STRING2}
|
||||
STR_CONFIG_SETTING_SHADED_TREES_ON_SLOPES_HELPTEXT :Change brightness of trees drawn on slopes. Improves the look of tree cover in mountainous areas.
|
||||
|
||||
STR_CONFIG_SETTING_DEMOLISH_CONFIRM_MODE :Ask before demolishing structures: {STRING2}
|
||||
STR_CONFIG_SETTING_DEMOLISH_CONFIRM_MODE_HELPTEXT :Ask for confirmation before irreversibly demolishing structures.
|
||||
STR_CONFIG_SETTING_DEMOLISH_CONFIRM_MODE_OFF :Off
|
||||
STR_CONFIG_SETTING_DEMOLISH_CONFIRM_MODE_INDUSTRY :Industries
|
||||
STR_CONFIG_SETTING_DEMOLISH_CONFIRM_MODE_ALL :Industries and rail stations
|
||||
|
||||
STR_CONFIG_SETTING_ADV_SIG_BRIDGE_TUN_MODES :Enable signals on bridges/tunnels advanced modes: {STRING2}
|
||||
STR_CONFIG_SETTING_ADV_SIG_BRIDGE_TUN_MODES_HELPTEXT :Enables use of advanced modes of signal simulation on bridges and tunnels. When disabled, bridges/tunnels which are not already in an advanced mode cannot be changed to an advanced mode, however other players may choose to enable this setting and use an advanced mode.
|
||||
|
||||
|
@@ -1758,6 +1758,7 @@ static SettingsContainer &GetSettingsTree()
|
||||
construction->Add(new SettingEntry("gui.quick_goto"));
|
||||
construction->Add(new SettingEntry("gui.default_rail_type"));
|
||||
construction->Add(new SettingEntry("gui.default_road_type"));
|
||||
construction->Add(new SettingEntry("gui.demolish_confirm_mode"));
|
||||
}
|
||||
|
||||
SettingsPage *departureboards = interface->Add(new SettingsPage(STR_CONFIG_SETTING_INTERFACE_DEPARTUREBOARDS));
|
||||
|
@@ -220,6 +220,7 @@ struct GUISettings : public TimeSettings {
|
||||
uint8 linkgraph_colours; ///< linkgraph overlay colours
|
||||
uint8 vehicle_names; ///< Vehicle naming scheme
|
||||
bool shade_trees_on_slopes; ///< Shade trees on slopes
|
||||
uint8 demolish_confirm_mode; ///< Demolition confirmation mode
|
||||
|
||||
uint16 console_backlog_timeout; ///< the minimum amount of time items should be in the console backlog before they will be removed in ~3 seconds granularity.
|
||||
uint16 console_backlog_length; ///< the minimum amount of items in the console backlog before items will be removed.
|
||||
|
@@ -5467,6 +5467,19 @@ strhelp = STR_CONFIG_SETTING_SHADED_TREES_ON_SLOPES_HELPTEXT
|
||||
proc = RedrawScreen
|
||||
cat = SC_BASIC
|
||||
|
||||
[SDTC_VAR]
|
||||
var = gui.demolish_confirm_mode
|
||||
type = SLE_UINT8
|
||||
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
|
||||
guiflags = SGF_MULTISTRING
|
||||
def = 2
|
||||
min = 0
|
||||
max = 2
|
||||
str = STR_CONFIG_SETTING_DEMOLISH_CONFIRM_MODE
|
||||
strhelp = STR_CONFIG_SETTING_DEMOLISH_CONFIRM_MODE_HELPTEXT
|
||||
strval = STR_CONFIG_SETTING_DEMOLISH_CONFIRM_MODE_OFF
|
||||
cat = SC_BASIC
|
||||
|
||||
; For the dedicated build we'll enable dates in logs by default.
|
||||
[SDTC_BOOL]
|
||||
ifdef = DEDICATED
|
||||
|
@@ -40,6 +40,12 @@
|
||||
|
||||
#include "safeguards.h"
|
||||
|
||||
enum DemolishConfirmMode {
|
||||
DCM_OFF,
|
||||
DCM_INDUSTRY,
|
||||
DCM_INDUSTRY_RAIL_STATION,
|
||||
};
|
||||
|
||||
void CcTerraform(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, uint64 p3, uint32 cmd)
|
||||
{
|
||||
if (result.Succeeded()) {
|
||||
@@ -97,8 +103,10 @@ static void GenerateRockyArea(TileIndex end, TileIndex start)
|
||||
}
|
||||
|
||||
/** Checks if the area contains any structures that are important enough to query about first */
|
||||
static bool IsIndustryOrRailStationInArea(TileIndex start_tile, TileIndex end_tile, bool diagonal)
|
||||
static bool IsQueryConfirmIndustryOrRailStationInArea(TileIndex start_tile, TileIndex end_tile, bool diagonal)
|
||||
{
|
||||
if (_settings_client.gui.demolish_confirm_mode == DCM_OFF) return false;
|
||||
|
||||
std::unique_ptr<TileIterator> tile_iterator;
|
||||
|
||||
if (diagonal) {
|
||||
@@ -111,7 +119,7 @@ static bool IsIndustryOrRailStationInArea(TileIndex start_tile, TileIndex end_ti
|
||||
|
||||
for (; *tile_iterator != INVALID_TILE; ++(*tile_iterator)) {
|
||||
if ((_cheats.magic_bulldozer.value && IsTileType(*tile_iterator, MP_INDUSTRY)) ||
|
||||
IsRailStationTile(*tile_iterator)) {
|
||||
(_settings_client.gui.demolish_confirm_mode == DCM_INDUSTRY_RAIL_STATION && IsRailStationTile(*tile_iterator))) {
|
||||
destroying_industry_or_station = true;
|
||||
break;
|
||||
}
|
||||
@@ -150,7 +158,7 @@ bool GUIPlaceProcDragXY(ViewportDragDropSelectionProcess proc, TileIndex start_t
|
||||
case DDSP_DEMOLISH_AREA: {
|
||||
_demolish_area_command = NewCommandContainerBasic(end_tile, start_tile, _ctrl_pressed ? 1 : 0, CMD_CLEAR_AREA | CMD_MSG(STR_ERROR_CAN_T_CLEAR_THIS_AREA), CcPlaySound_EXPLOSION);
|
||||
|
||||
if (IsIndustryOrRailStationInArea(start_tile, end_tile, _ctrl_pressed)) {
|
||||
if (IsQueryConfirmIndustryOrRailStationInArea(start_tile, end_tile, _ctrl_pressed)) {
|
||||
ShowQuery(STR_QUERY_CLEAR_AREA_CAPTION, STR_CLEAR_AREA_CONFIRMATION_TEXT, nullptr, DemolishAreaConfirmationCallback);
|
||||
} else {
|
||||
DemolishAreaConfirmationCallback(nullptr, true);
|
||||
|
Reference in New Issue
Block a user