src/clear_cmd.cpp
branchNewGRF_ports
changeset 6743 cabfaa4a0295
parent 6720 35756db7e577
child 6868 7eb395287b3d
equal deleted inserted replaced
6742:1337d6c9b97b 6743:cabfaa4a0295
   177 		return false;
   177 		return false;
   178 	}
   178 	}
   179 
   179 
   180 	_error_message = STR_1004_TOO_HIGH;
   180 	_error_message = STR_1004_TOO_HIGH;
   181 
   181 
   182 	if (height > 15) return false;
   182 	if (height > MAX_TILE_HEIGHT) return false;
   183 
   183 
   184 	nh = TerraformGetHeightOfTile(ts, tile);
   184 	nh = TerraformGetHeightOfTile(ts, tile);
   185 	if (nh < 0 || height == nh) return false;
   185 	if (nh < 0 || height == nh) return false;
   186 
   186 
   187 	if (TerraformProc(ts, tile, 0) < 0) return false;
   187 	if (TerraformProc(ts, tile, 0) < 0) return false;
   571 	Slope tileh = GetTileSlope(tile, &z);
   571 	Slope tileh = GetTileSlope(tile, &z);
   572 
   572 
   573 	return z + GetPartialZ(x & 0xF, y & 0xF, tileh);
   573 	return z + GetPartialZ(x & 0xF, y & 0xF, tileh);
   574 }
   574 }
   575 
   575 
   576 static Slope GetSlopeTileh_Clear(TileIndex tile, Slope tileh)
   576 static Foundation GetFoundation_Clear(TileIndex tile, Slope tileh)
   577 {
   577 {
   578 	return tileh;
   578 	return FOUNDATION_NONE;
   579 }
   579 }
   580 
   580 
   581 static void GetAcceptedCargo_Clear(TileIndex tile, AcceptedCargo ac)
   581 static void GetAcceptedCargo_Clear(TileIndex tile, AcceptedCargo ac)
   582 {
   582 {
   583 	/* unused */
   583 	/* unused */
   756 				TileIndex tile_new;
   756 				TileIndex tile_new;
   757 
   757 
   758 				SetClearGroundDensity(tile, CLEAR_ROCKS, 3);
   758 				SetClearGroundDensity(tile, CLEAR_ROCKS, 3);
   759 				do {
   759 				do {
   760 					if (--j == 0) goto get_out;
   760 					if (--j == 0) goto get_out;
   761 					tile_new = tile + TileOffsByDiagDir(GB(Random(), 0, 2));
   761 					tile_new = tile + TileOffsByDiagDir((DiagDirection)GB(Random(), 0, 2));
   762 				} while (!IsTileType(tile_new, MP_CLEAR) || IsClearGround(tile_new, CLEAR_DESERT));
   762 				} while (!IsTileType(tile_new, MP_CLEAR) || IsClearGround(tile_new, CLEAR_DESERT));
   763 				tile = tile_new;
   763 				tile = tile_new;
   764 			}
   764 			}
   765 get_out:;
   765 get_out:;
   766 		}
   766 		}
   817 	AnimateTile_Clear,        ///< animate_tile_proc
   817 	AnimateTile_Clear,        ///< animate_tile_proc
   818 	TileLoop_Clear,           ///< tile_loop_clear
   818 	TileLoop_Clear,           ///< tile_loop_clear
   819 	ChangeTileOwner_Clear,    ///< change_tile_owner_clear
   819 	ChangeTileOwner_Clear,    ///< change_tile_owner_clear
   820 	NULL,                     ///< get_produced_cargo_proc
   820 	NULL,                     ///< get_produced_cargo_proc
   821 	NULL,                     ///< vehicle_enter_tile_proc
   821 	NULL,                     ///< vehicle_enter_tile_proc
   822 	GetSlopeTileh_Clear,      ///< get_slope_tileh_proc
   822 	GetFoundation_Clear,      ///< get_foundation_proc
   823 };
   823 };