mirror of https://github.com/OpenTTD/OpenTTD
(svn r9950) -Feature(tte): allow terraforming under bridges.
parent
c69458d894
commit
8602acc433
|
@ -291,24 +291,24 @@ int32 CmdTerraformLand(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||||
for (count = ts.tile_table_count; count != 0; count--, ti++) {
|
for (count = ts.tile_table_count; count != 0; count--, ti++) {
|
||||||
TileIndex tile = *ti;
|
TileIndex tile = *ti;
|
||||||
|
|
||||||
if (MayHaveBridgeAbove(tile) && IsBridgeAbove(tile)) {
|
uint z_min = TerraformGetHeightOfTile(&ts, tile + TileDiffXY(0, 0));
|
||||||
|
uint z_max = z_min;
|
||||||
|
uint t = TerraformGetHeightOfTile(&ts, tile + TileDiffXY(1, 0));
|
||||||
|
z_min = min(z_min, t);
|
||||||
|
z_max = max(z_max, t);
|
||||||
|
t = TerraformGetHeightOfTile(&ts, tile + TileDiffXY(1, 1));
|
||||||
|
z_min = min(z_min, t);
|
||||||
|
z_max = max(z_max, t);
|
||||||
|
t = TerraformGetHeightOfTile(&ts, tile + TileDiffXY(0, 1));
|
||||||
|
z_min = min(z_min, t);
|
||||||
|
z_max = max(z_max, t);
|
||||||
|
|
||||||
|
if (direction == 1 && MayHaveBridgeAbove(tile) && IsBridgeAbove(tile) &&
|
||||||
|
GetBridgeHeight(GetSouthernBridgeEnd(tile)) <= z_max * TILE_HEIGHT) {
|
||||||
return_cmd_error(STR_5007_MUST_DEMOLISH_BRIDGE_FIRST);
|
return_cmd_error(STR_5007_MUST_DEMOLISH_BRIDGE_FIRST);
|
||||||
}
|
}
|
||||||
|
if (direction == -1 && IsTunnelInWay(tile, z_min * TILE_HEIGHT)) {
|
||||||
if (direction == -1) {
|
return_cmd_error(STR_1002_EXCAVATION_WOULD_DAMAGE);
|
||||||
uint z, t;
|
|
||||||
|
|
||||||
z = TerraformGetHeightOfTile(&ts, tile + TileDiffXY(0, 0));
|
|
||||||
t = TerraformGetHeightOfTile(&ts, tile + TileDiffXY(1, 0));
|
|
||||||
if (t <= z) z = t;
|
|
||||||
t = TerraformGetHeightOfTile(&ts, tile + TileDiffXY(1, 1));
|
|
||||||
if (t <= z) z = t;
|
|
||||||
t = TerraformGetHeightOfTile(&ts, tile + TileDiffXY(0, 1));
|
|
||||||
if (t <= z) z = t;
|
|
||||||
|
|
||||||
if (IsTunnelInWay(tile, z * TILE_HEIGHT)) {
|
|
||||||
return_cmd_error(STR_1002_EXCAVATION_WOULD_DAMAGE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue