(svn r3644) Don't use FindLandscapeHeightByTile() when it's overkill - often it was just a complicated way of writing GetTileSlope(tile, NULL)

This commit is contained in:
tron
2006-02-21 07:41:54 +00:00
parent 35fb17947a
commit 4b46883751
6 changed files with 83 additions and 86 deletions

View File

@@ -620,25 +620,24 @@ int32 CmdRemoveLongRoad(int x, int y, uint32 flags, uint32 p1, uint32 p2)
*/
int32 CmdBuildRoadDepot(int x, int y, uint32 flags, uint32 p1, uint32 p2)
{
TileInfo ti;
int32 cost;
Depot *dep;
TileIndex tile;
uint tileh;
SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
if (p1 > 3) return CMD_ERROR; // check direction
FindLandscapeHeight(&ti, x, y);
tile = ti.tile;
tile = TileVirtXY(x, y);
if (!EnsureNoVehicle(tile)) return CMD_ERROR;
if (ti.tileh != 0 && (
tileh = GetTileSlope(tile, NULL);
if (tileh != 0 && (
!_patches.build_on_slopes ||
IsSteepTileh(ti.tileh) ||
!CanBuildDepotByTileh(p1, ti.tileh)
IsSteepTileh(tileh) ||
!CanBuildDepotByTileh(p1, tileh)
)) {
return_cmd_error(STR_0007_FLAT_LAND_REQUIRED);
}