Disallow building bridges over airports
This commit is contained in:
@@ -1886,7 +1886,7 @@ STR_CONFIG_SETTING_ALLOW_GRF_OBJECTS_UNDER_BRIDGES :Allow all NewGR
|
|||||||
STR_CONFIG_SETTING_ALLOW_GRF_OBJECTS_UNDER_BRIDGES_HELPTEXT :Allow all NewGRF objects to be built under bridges, even where not otherwise enabled by the GRF.{}This may result in graphical issues.
|
STR_CONFIG_SETTING_ALLOW_GRF_OBJECTS_UNDER_BRIDGES_HELPTEXT :Allow all NewGRF objects to be built under bridges, even where not otherwise enabled by the GRF.{}This may result in graphical issues.
|
||||||
|
|
||||||
STR_CONFIG_SETTING_ALLOW_STATIONS_UNDER_BRIDGES :Allow stations under bridges: {STRING2}
|
STR_CONFIG_SETTING_ALLOW_STATIONS_UNDER_BRIDGES :Allow stations under bridges: {STRING2}
|
||||||
STR_CONFIG_SETTING_ALLOW_STATIONS_UNDER_BRIDGES_HELPTEXT :Allow stations to be built under bridges.{}This may result in graphical issues.
|
STR_CONFIG_SETTING_ALLOW_STATIONS_UNDER_BRIDGES_HELPTEXT :Allow stations to be built under bridges (excluding airports).{}This may result in graphical issues.
|
||||||
|
|
||||||
STR_CONFIG_SETTING_QUERY_CAPTION :{WHITE}Change setting value
|
STR_CONFIG_SETTING_QUERY_CAPTION :{WHITE}Change setting value
|
||||||
|
|
||||||
|
@@ -731,9 +731,9 @@ CommandCost ClearTile_Station(TileIndex tile, DoCommandFlag flags);
|
|||||||
* @param check_bridge Check for the existence of a bridge.
|
* @param check_bridge Check for the existence of a bridge.
|
||||||
* @return The cost in case of success, or an error code if it failed.
|
* @return The cost in case of success, or an error code if it failed.
|
||||||
*/
|
*/
|
||||||
CommandCost CheckBuildableTile(TileIndex tile, uint invalid_dirs, int &allowed_z, bool allow_steep, bool check_bridge = true)
|
CommandCost CheckBuildableTile(TileIndex tile, uint invalid_dirs, int &allowed_z, bool allow_steep, bool check_bridge)
|
||||||
{
|
{
|
||||||
if (check_bridge && IsBridgeAbove(tile) && !_settings_game.construction.allow_stations_under_bridges) {
|
if (check_bridge && IsBridgeAbove(tile)) {
|
||||||
return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);
|
return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -775,30 +775,6 @@ CommandCost CheckBuildableTile(TileIndex tile, uint invalid_dirs, int &allowed_z
|
|||||||
return cost;
|
return cost;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Tries to clear the given area.
|
|
||||||
* @param tile_area Area to check.
|
|
||||||
* @param flags Operation to perform.
|
|
||||||
* @return The cost in case of success, or an error code if it failed.
|
|
||||||
*/
|
|
||||||
CommandCost CheckFlatLand(TileArea tile_area, DoCommandFlag flags)
|
|
||||||
{
|
|
||||||
CommandCost cost(EXPENSES_CONSTRUCTION);
|
|
||||||
int allowed_z = -1;
|
|
||||||
|
|
||||||
TILE_AREA_LOOP(tile_cur, tile_area) {
|
|
||||||
CommandCost ret = CheckBuildableTile(tile_cur, 0, allowed_z, true);
|
|
||||||
if (ret.Failed()) return ret;
|
|
||||||
cost.AddCost(ret);
|
|
||||||
|
|
||||||
ret = DoCommand(tile_cur, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
|
|
||||||
if (ret.Failed()) return ret;
|
|
||||||
cost.AddCost(ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
return cost;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if a rail station can be built at the given area.
|
* Checks if a rail station can be built at the given area.
|
||||||
* @param tile_area Area to check.
|
* @param tile_area Area to check.
|
||||||
@@ -823,7 +799,7 @@ static CommandCost CheckFlatLandRailStation(TileArea tile_area, DoCommandFlag fl
|
|||||||
bool slope_cb = statspec != NULL && HasBit(statspec->callback_mask, CBM_STATION_SLOPE_CHECK);
|
bool slope_cb = statspec != NULL && HasBit(statspec->callback_mask, CBM_STATION_SLOPE_CHECK);
|
||||||
|
|
||||||
TILE_AREA_LOOP(tile_cur, tile_area) {
|
TILE_AREA_LOOP(tile_cur, tile_area) {
|
||||||
CommandCost ret = CheckBuildableTile(tile_cur, invalid_dirs, allowed_z, false);
|
CommandCost ret = CheckBuildableTile(tile_cur, invalid_dirs, allowed_z, false, !_settings_game.construction.allow_stations_under_bridges);
|
||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
cost.AddCost(ret);
|
cost.AddCost(ret);
|
||||||
|
|
||||||
@@ -905,7 +881,7 @@ static CommandCost CheckFlatLandRoadStop(TileArea tile_area, DoCommandFlag flags
|
|||||||
int allowed_z = -1;
|
int allowed_z = -1;
|
||||||
|
|
||||||
TILE_AREA_LOOP(cur_tile, tile_area) {
|
TILE_AREA_LOOP(cur_tile, tile_area) {
|
||||||
CommandCost ret = CheckBuildableTile(cur_tile, invalid_dirs, allowed_z, !is_drive_through);
|
CommandCost ret = CheckBuildableTile(cur_tile, invalid_dirs, allowed_z, !is_drive_through, !_settings_game.construction.allow_stations_under_bridges);
|
||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
cost.AddCost(ret);
|
cost.AddCost(ret);
|
||||||
|
|
||||||
@@ -1009,7 +985,7 @@ static CommandCost CheckFlatLandAirport(TileArea tile_area, DoCommandFlag flags,
|
|||||||
int allowed_z = -1;
|
int allowed_z = -1;
|
||||||
|
|
||||||
TILE_AREA_LOOP(tile_cur, tile_area) {
|
TILE_AREA_LOOP(tile_cur, tile_area) {
|
||||||
CommandCost ret = CheckBuildableTile(tile_cur, 0, allowed_z, true);
|
CommandCost ret = CheckBuildableTile(tile_cur, 0, allowed_z, true, true);
|
||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
cost.AddCost(ret);
|
cost.AddCost(ret);
|
||||||
|
|
||||||
|
@@ -502,7 +502,7 @@ CommandCost CmdBuildBridge(TileIndex end_tile, DoCommandFlag flags, uint32 p1, u
|
|||||||
}
|
}
|
||||||
|
|
||||||
case MP_STATION: {
|
case MP_STATION: {
|
||||||
if (!_settings_game.construction.allow_stations_under_bridges) goto not_valid_below;
|
if (!_settings_game.construction.allow_stations_under_bridges || IsAirport(tile)) goto not_valid_below;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user