Changeset - r17666:45f9e55687f7
[Not reviewed]
master
0 1 0
alberth - 13 years ago 2011-05-14 09:26:16
alberth@openttd.org
(svn r22451) -Codechange: Test for bridges and tunnels during the first pass only while terraforming (HackaLittleBit)
1 file changed with 12 insertions and 10 deletions:
0 comments (0 inline, 0 general)
src/terraform_cmd.cpp
Show inline comments
 
@@ -305,22 +305,24 @@ CommandCost CmdTerraformLand(TileIndex t
 
			Slope tileh = (z_max > z_min + 1 ? SLOPE_STEEP : SLOPE_FLAT);
 
			if (z_W > z_min) tileh |= SLOPE_W;
 
			if (z_S > z_min) tileh |= SLOPE_S;
 
			if (z_E > z_min) tileh |= SLOPE_E;
 
			if (z_N > z_min) tileh |= SLOPE_N;
 

	
 
			/* Check if bridge would take damage */
 
			if (direction == 1 && MayHaveBridgeAbove(tile) && IsBridgeAbove(tile) &&
 
					GetBridgeHeight(GetSouthernBridgeEnd(tile)) <= z_max * TILE_HEIGHT) {
 
				_terraform_err_tile = tile; // highlight the tile under the bridge
 
				return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);
 
			}
 
			/* Check if tunnel would take damage */
 
			if (direction == -1 && IsTunnelInWay(tile, z_min * TILE_HEIGHT)) {
 
				_terraform_err_tile = tile; // highlight the tile above the tunnel
 
				return_cmd_error(STR_ERROR_EXCAVATION_WOULD_DAMAGE);
 
			if (pass == 0) {
 
				/* Check if bridge would take damage */
 
				if (direction == 1 && MayHaveBridgeAbove(tile) && IsBridgeAbove(tile) &&
 
						GetBridgeHeight(GetSouthernBridgeEnd(tile)) <= z_max * TILE_HEIGHT) {
 
					_terraform_err_tile = tile; // highlight the tile under the bridge
 
					return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);
 
				}
 
				/* Check if tunnel would take damage */
 
				if (direction == -1 && IsTunnelInWay(tile, z_min * TILE_HEIGHT)) {
 
					_terraform_err_tile = tile; // highlight the tile above the tunnel
 
					return_cmd_error(STR_ERROR_EXCAVATION_WOULD_DAMAGE);
 
				}
 
			}
 

	
 
			/* Is the tile already cleared? */
 
			const ClearedObjectArea *coa = FindClearedObject(tile);
 
			bool indirectly_cleared = coa != NULL && coa->first_tile != tile;
 

	
0 comments (0 inline, 0 general)