Add setting to disable removing sea/rivers
This commit is contained in:
@@ -420,6 +420,7 @@ enum DoCommandFlag {
|
|||||||
DC_ALL_TILES = 0x200, ///< allow this command also on MP_VOID tiles
|
DC_ALL_TILES = 0x200, ///< allow this command also on MP_VOID tiles
|
||||||
DC_NO_MODIFY_TOWN_RATING = 0x400, ///< do not change town rating
|
DC_NO_MODIFY_TOWN_RATING = 0x400, ///< do not change town rating
|
||||||
DC_FORCE_CLEAR_TILE = 0x800, ///< do not only remove the object on the tile, but also clear any water left on it
|
DC_FORCE_CLEAR_TILE = 0x800, ///< do not only remove the object on the tile, but also clear any water left on it
|
||||||
|
DC_ALLOW_REMOVE_WATER = 0x1000,///< always allow removing water
|
||||||
};
|
};
|
||||||
DECLARE_ENUM_AS_BIT_SET(DoCommandFlag)
|
DECLARE_ENUM_AS_BIT_SET(DoCommandFlag)
|
||||||
|
|
||||||
|
@@ -622,7 +622,9 @@ CommandCost CmdLandscapeClear(TileIndex tile, DoCommandFlag flags, uint32 p1, ui
|
|||||||
if ((flags & DC_FORCE_CLEAR_TILE) && HasTileWaterClass(tile) && IsTileOnWater(tile) && !IsWaterTile(tile) && !IsCoastTile(tile)) {
|
if ((flags & DC_FORCE_CLEAR_TILE) && HasTileWaterClass(tile) && IsTileOnWater(tile) && !IsWaterTile(tile) && !IsCoastTile(tile)) {
|
||||||
if ((flags & DC_AUTO) && GetWaterClass(tile) == WATER_CLASS_CANAL) return_cmd_error(STR_ERROR_MUST_DEMOLISH_CANAL_FIRST);
|
if ((flags & DC_AUTO) && GetWaterClass(tile) == WATER_CLASS_CANAL) return_cmd_error(STR_ERROR_MUST_DEMOLISH_CANAL_FIRST);
|
||||||
do_clear = true;
|
do_clear = true;
|
||||||
cost.AddCost(GetWaterClass(tile) == WATER_CLASS_CANAL ? _price[PR_CLEAR_CANAL] : _price[PR_CLEAR_WATER]);
|
const bool is_canal = GetWaterClass(tile) == WATER_CLASS_CANAL;
|
||||||
|
if (!is_canal && _game_mode != GM_EDITOR && !_settings_game.construction.enable_remove_water && !(flags & DC_ALLOW_REMOVE_WATER)) return_cmd_error(STR_ERROR_CAN_T_BUILD_ON_WATER);
|
||||||
|
cost.AddCost(is_canal ? _price[PR_CLEAR_CANAL] : _price[PR_CLEAR_WATER]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Company *c = (flags & (DC_AUTO | DC_BANKRUPT)) ? NULL : Company::GetIfValid(_current_company);
|
Company *c = (flags & (DC_AUTO | DC_BANKRUPT)) ? NULL : Company::GetIfValid(_current_company);
|
||||||
|
@@ -1502,6 +1502,8 @@ STR_CONFIG_SETTING_EXPENSES_LAYOUT_HELPTEXT :Define the layo
|
|||||||
|
|
||||||
STR_CONFIG_SETTING_ENABLE_BUILD_RIVER :Enable building rivers: {STRING2}
|
STR_CONFIG_SETTING_ENABLE_BUILD_RIVER :Enable building rivers: {STRING2}
|
||||||
STR_CONFIG_SETTING_ENABLE_BUILD_RIVER_HELPTEXT :Enable building rivers outside of the scenario editor
|
STR_CONFIG_SETTING_ENABLE_BUILD_RIVER_HELPTEXT :Enable building rivers outside of the scenario editor
|
||||||
|
STR_CONFIG_SETTING_ENABLE_REMOVE_WATER :Enable removing sea and rivers: {STRING2}
|
||||||
|
STR_CONFIG_SETTING_ENABLE_REMOVE_WATER_HELPTEXT :Enable removing sea and rivers outside of the scenario editor
|
||||||
|
|
||||||
STR_CONFIG_SETTING_SOUND_TICKER :News ticker: {STRING2}
|
STR_CONFIG_SETTING_SOUND_TICKER :News ticker: {STRING2}
|
||||||
STR_CONFIG_SETTING_SOUND_TICKER_HELPTEXT :Play sound for summarised news messages
|
STR_CONFIG_SETTING_SOUND_TICKER_HELPTEXT :Play sound for summarised news messages
|
||||||
|
@@ -581,7 +581,7 @@ CommandCost CmdBuildSingleRail(TileIndex tile, DoCommandFlag flags, uint32 p1, u
|
|||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
cost.AddCost(ret);
|
cost.AddCost(ret);
|
||||||
|
|
||||||
ret = DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
|
ret = DoCommand(tile, 0, 0, flags | DC_ALLOW_REMOVE_WATER, CMD_LANDSCAPE_CLEAR);
|
||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
cost.AddCost(ret);
|
cost.AddCost(ret);
|
||||||
|
|
||||||
@@ -2014,6 +2014,8 @@ static CommandCost ClearTile_Track(TileIndex tile, DoCommandFlag flags)
|
|||||||
CommandCost ret = EnsureNoVehicleOnGround(tile);
|
CommandCost ret = EnsureNoVehicleOnGround(tile);
|
||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
|
|
||||||
|
if (_game_mode != GM_EDITOR && !_settings_game.construction.enable_remove_water && !(flags & DC_ALLOW_REMOVE_WATER)) return_cmd_error(STR_ERROR_CAN_T_BUILD_ON_WATER);
|
||||||
|
|
||||||
/* The track was removed, and left a coast tile. Now also clear the water. */
|
/* The track was removed, and left a coast tile. Now also clear the water. */
|
||||||
if (flags & DC_EXEC) DoClearSquare(tile);
|
if (flags & DC_EXEC) DoClearSquare(tile);
|
||||||
cost.AddCost(_price[PR_CLEAR_WATER]);
|
cost.AddCost(_price[PR_CLEAR_WATER]);
|
||||||
@@ -3239,7 +3241,10 @@ static CommandCost TestAutoslopeOnRailTile(TileIndex tile, uint flags, int z_old
|
|||||||
/* Make the ground dirty, if surface slope has changed */
|
/* Make the ground dirty, if surface slope has changed */
|
||||||
if (tileh_old != tileh_new) {
|
if (tileh_old != tileh_new) {
|
||||||
/* If there is flat water on the lower halftile add the cost for clearing it */
|
/* If there is flat water on the lower halftile add the cost for clearing it */
|
||||||
if (GetRailGroundType(tile) == RAIL_GROUND_WATER && IsSlopeWithOneCornerRaised(tileh_old)) cost.AddCost(_price[PR_CLEAR_WATER]);
|
if (GetRailGroundType(tile) == RAIL_GROUND_WATER && IsSlopeWithOneCornerRaised(tileh_old)) {
|
||||||
|
if (_game_mode != GM_EDITOR && !_settings_game.construction.enable_remove_water && !(flags & DC_ALLOW_REMOVE_WATER)) return_cmd_error(STR_ERROR_CAN_T_BUILD_ON_WATER);
|
||||||
|
cost.AddCost(_price[PR_CLEAR_WATER]);
|
||||||
|
}
|
||||||
if ((flags & DC_EXEC) != 0) SetRailGroundType(tile, RAIL_GROUND_BARREN);
|
if ((flags & DC_EXEC) != 0) SetRailGroundType(tile, RAIL_GROUND_BARREN);
|
||||||
}
|
}
|
||||||
return cost;
|
return cost;
|
||||||
@@ -3265,6 +3270,8 @@ static CommandCost TerraformTile_Track(TileIndex tile, DoCommandFlag flags, int
|
|||||||
/* Allow clearing the water only if there is no ship */
|
/* Allow clearing the water only if there is no ship */
|
||||||
if (was_water && HasVehicleOnPos(tile, NULL, &EnsureNoShipProc)) return_cmd_error(STR_ERROR_SHIP_IN_THE_WAY);
|
if (was_water && HasVehicleOnPos(tile, NULL, &EnsureNoShipProc)) return_cmd_error(STR_ERROR_SHIP_IN_THE_WAY);
|
||||||
|
|
||||||
|
if (was_water && _game_mode != GM_EDITOR && !_settings_game.construction.enable_remove_water && !(flags & DC_ALLOW_REMOVE_WATER)) return_cmd_error(STR_ERROR_CAN_T_BUILD_ON_WATER);
|
||||||
|
|
||||||
/* First test autoslope. However if it succeeds we still have to test the rest, because non-autoslope terraforming is cheaper. */
|
/* First test autoslope. However if it succeeds we still have to test the rest, because non-autoslope terraforming is cheaper. */
|
||||||
CommandCost autoslope_result = TestAutoslopeOnRailTile(tile, flags, z_old, tileh_old, z_new, tileh_new, rail_bits);
|
CommandCost autoslope_result = TestAutoslopeOnRailTile(tile, flags, z_old, tileh_old, z_new, tileh_new, rail_bits);
|
||||||
|
|
||||||
|
@@ -1721,6 +1721,7 @@ static SettingsContainer &GetSettingsTree()
|
|||||||
limitations->Add(new SettingEntry("vehicle.disable_elrails"));
|
limitations->Add(new SettingEntry("vehicle.disable_elrails"));
|
||||||
limitations->Add(new SettingEntry("construction.maximum_signal_evaluations"));
|
limitations->Add(new SettingEntry("construction.maximum_signal_evaluations"));
|
||||||
limitations->Add(new SettingEntry("construction.enable_build_river"));
|
limitations->Add(new SettingEntry("construction.enable_build_river"));
|
||||||
|
limitations->Add(new SettingEntry("construction.enable_remove_water"));
|
||||||
limitations->Add(new SettingEntry("construction.road_custom_bridge_heads"));
|
limitations->Add(new SettingEntry("construction.road_custom_bridge_heads"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -356,6 +356,7 @@ struct ConstructionSettings {
|
|||||||
uint16 maximum_signal_evaluations; ///< maximum number of programmable signals which may be evaluated in one pass
|
uint16 maximum_signal_evaluations; ///< maximum number of programmable signals which may be evaluated in one pass
|
||||||
byte simulated_wormhole_signals; ///< simulate signals in tunnel
|
byte simulated_wormhole_signals; ///< simulate signals in tunnel
|
||||||
bool enable_build_river; ///< enable building rivers in-game
|
bool enable_build_river; ///< enable building rivers in-game
|
||||||
|
bool enable_remove_water; ///< enable removing sea and rivers in-game
|
||||||
uint8 road_custom_bridge_heads; ///< allow construction of road custom bridge heads
|
uint8 road_custom_bridge_heads; ///< allow construction of road custom bridge heads
|
||||||
bool chunnel; ///< allow construction of tunnels under water
|
bool chunnel; ///< allow construction of tunnels under water
|
||||||
|
|
||||||
|
@@ -468,6 +468,15 @@ str = STR_CONFIG_SETTING_ENABLE_BUILD_RIVER
|
|||||||
strhelp = STR_CONFIG_SETTING_ENABLE_BUILD_RIVER_HELPTEXT
|
strhelp = STR_CONFIG_SETTING_ENABLE_BUILD_RIVER_HELPTEXT
|
||||||
patxname = ""enable_build_river.construction.enable_build_river""
|
patxname = ""enable_build_river.construction.enable_build_river""
|
||||||
|
|
||||||
|
[SDT_BOOL]
|
||||||
|
base = GameSettings
|
||||||
|
var = construction.enable_remove_water
|
||||||
|
def = true
|
||||||
|
cat = SC_BASIC
|
||||||
|
str = STR_CONFIG_SETTING_ENABLE_REMOVE_WATER
|
||||||
|
strhelp = STR_CONFIG_SETTING_ENABLE_REMOVE_WATER_HELPTEXT
|
||||||
|
patxname = ""enable_build_river.construction.enable_remove_water""
|
||||||
|
|
||||||
[SDT_VAR]
|
[SDT_VAR]
|
||||||
base = GameSettings
|
base = GameSettings
|
||||||
var = construction.terraform_per_64k_frames
|
var = construction.terraform_per_64k_frames
|
||||||
|
@@ -476,6 +476,8 @@ static CommandCost ClearTile_Water(TileIndex tile, DoCommandFlag flags)
|
|||||||
case WATER_TILE_CLEAR: {
|
case WATER_TILE_CLEAR: {
|
||||||
if (flags & DC_NO_WATER) return_cmd_error(STR_ERROR_CAN_T_BUILD_ON_WATER);
|
if (flags & DC_NO_WATER) return_cmd_error(STR_ERROR_CAN_T_BUILD_ON_WATER);
|
||||||
|
|
||||||
|
if (!IsCanal(tile) && _game_mode != GM_EDITOR && !_settings_game.construction.enable_remove_water && !(flags & DC_ALLOW_REMOVE_WATER)) return_cmd_error(STR_ERROR_CAN_T_BUILD_ON_WATER);
|
||||||
|
|
||||||
Money base_cost = IsCanal(tile) ? _price[PR_CLEAR_CANAL] : _price[PR_CLEAR_WATER];
|
Money base_cost = IsCanal(tile) ? _price[PR_CLEAR_CANAL] : _price[PR_CLEAR_WATER];
|
||||||
/* Make sure freeform edges are allowed or it's not an edge tile. */
|
/* Make sure freeform edges are allowed or it's not an edge tile. */
|
||||||
if (!_settings_game.construction.freeform_edges && (!IsInsideMM(TileX(tile), 1, MapMaxX() - 1) ||
|
if (!_settings_game.construction.freeform_edges && (!IsInsideMM(TileX(tile), 1, MapMaxX() - 1) ||
|
||||||
@@ -512,15 +514,17 @@ static CommandCost ClearTile_Water(TileIndex tile, DoCommandFlag flags)
|
|||||||
CommandCost ret = EnsureNoVehicleOnGround(tile);
|
CommandCost ret = EnsureNoVehicleOnGround(tile);
|
||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
|
|
||||||
|
if (IsSlopeWithOneCornerRaised(slope)) {
|
||||||
|
if (_game_mode != GM_EDITOR && !_settings_game.construction.enable_remove_water && !(flags & DC_ALLOW_REMOVE_WATER)) return_cmd_error(STR_ERROR_CAN_T_BUILD_ON_WATER);
|
||||||
|
ret = CommandCost(EXPENSES_CONSTRUCTION, _price[PR_CLEAR_WATER]);
|
||||||
|
} else {
|
||||||
|
ret = CommandCost(EXPENSES_CONSTRUCTION, _price[PR_CLEAR_ROUGH]);
|
||||||
|
}
|
||||||
if (flags & DC_EXEC) {
|
if (flags & DC_EXEC) {
|
||||||
DoClearSquare(tile);
|
DoClearSquare(tile);
|
||||||
MarkCanalsAndRiversAroundDirty(tile);
|
MarkCanalsAndRiversAroundDirty(tile);
|
||||||
}
|
}
|
||||||
if (IsSlopeWithOneCornerRaised(slope)) {
|
return ret;
|
||||||
return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_CLEAR_WATER]);
|
|
||||||
} else {
|
|
||||||
return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_CLEAR_ROUGH]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case WATER_TILE_LOCK: {
|
case WATER_TILE_LOCK: {
|
||||||
|
Reference in New Issue
Block a user