diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp index 856d80fe97..70dd732158 100644 --- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -21,6 +21,7 @@ #include "cheat_type.h" #include "genworld.h" #include "tree_map.h" +#include "tunnel_map.h" #include "newgrf_cargo.h" #include "newgrf_debug.h" #include "newgrf_industrytiles.h" @@ -1457,6 +1458,11 @@ static CommandCost CheckIfIndustryIsAllowed(TileIndex tile, int type, const Town return_cmd_error(STR_ERROR_CAN_ONLY_BE_BUILT_NEAR_TOWN_CENTER); } + if (type == IT_OIL_RIG && + (IsTunnelInWay(tile, 0) || + IsTunnelInWay(tile + TileDiffXY(0, 1), 0) || + IsTunnelInWay(tile + TileDiffXY(1, 2), 0))) return_cmd_error(STR_ERROR_NO_DRILLING_ABOVE_CHUNNEL); + return CommandCost(); } diff --git a/src/lang/english.txt b/src/lang/english.txt index ff19eab31d..6d0796da49 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -5003,6 +5003,7 @@ STR_ERROR_TUNNEL_THROUGH_MAP_BORDER :{WHITE}Tunnel w STR_ERROR_UNABLE_TO_EXCAVATE_LAND :{WHITE}Unable to excavate land for other end of tunnel STR_ERROR_TUNNEL_TOO_LONG :{WHITE}... tunnel too long STR_ERROR_TUNNEL_RAMP_TOO_SHORT :{WHITE}... Ramp too short, tunnels under water have minimal three tiles at the begin and end. +STR_ERROR_NO_DRILLING_ABOVE_CHUNNEL :{WHITE}No oil rigs allowed above underwater tunnels. # Object related errors STR_ERROR_TOO_MANY_OBJECTS :{WHITE}... too many objects diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp index 67d76b4c8c..df03af37a6 100644 --- a/src/tunnelbridge_cmd.cpp +++ b/src/tunnelbridge_cmd.cpp @@ -44,6 +44,8 @@ #include "water.h" #include "company_gui.h" #include "viewport_func.h" +#include "station_map.h" +#include "industry_map.h" #include "table/strings.h" #include "table/bridge_land.h" @@ -707,6 +709,12 @@ CommandCost CmdBuildTunnel(TileIndex start_tile, DoCommandFlag flags, uint32 p1, if(direction == DIAGDIR_SW && (end_tileh & SLOPE_SW) == SLOPE_SW) break; if(direction == DIAGDIR_NW && (end_tileh & SLOPE_NW) == SLOPE_NW) break; + /* No drilling under oil rigs.*/ + if ((IsTileType(end_tile, MP_STATION) && IsOilRig(end_tile)) || + (IsTileType(end_tile, MP_INDUSTRY) && + GetIndustryGfx(end_tile) >= GFX_OILRIG_1 && + GetIndustryGfx(end_tile) <= GFX_OILRIG_5)) return_cmd_error(STR_ERROR_NO_DRILLING_ABOVE_CHUNNEL); + end_tile += delta; tiles++; }