Chunnel patch 28397: Codechange: Chunnels can't pass oilrigs.

https://www.tt-forums.net/viewtopic.php?p=1183416#p1183416
pull/16/head
HackaLittleBit 7 years ago committed by Jonathan G Rennison
parent dfce9cc4c0
commit 1ac8f66de1

@ -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();
}

@ -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

@ -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++;
}

Loading…
Cancel
Save