summaryrefslogtreecommitdiff
path: root/waypoint.c
diff options
context:
space:
mode:
authorcelestar <celestar@openttd.org>2005-07-16 23:47:37 +0000
committercelestar <celestar@openttd.org>2005-07-16 23:47:37 +0000
commit9ca761b06534ed191b0624a6c7049db296997a73 (patch)
treeb32b3e56573203f32982f2fc2b3966529a6d1857 /waypoint.c
parent64f6839816221873b9a5327fe038533a7d3b8a98 (diff)
downloadopenttd-9ca761b06534ed191b0624a6c7049db296997a73.tar.xz
(svn r2595) -Codechange: Introduced "IsSteepTileh" to find whether a tile is steep
(i.e. spans two height levels) and use it throughout the code. -Codechange: Add CanBuildDepotByTileh to find if a tile is suitable to build a depot on it. Wraps some bitmagic which seems quite unreadable at first glance
Diffstat (limited to 'waypoint.c')
-rw-r--r--waypoint.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/waypoint.c b/waypoint.c
index aa5d543b4..539d72b45 100644
--- a/waypoint.c
+++ b/waypoint.c
@@ -152,6 +152,9 @@ static Waypoint *FindDeletedWaypointCloseTo(TileIndex tile)
* @param x,y coordinates where waypoint will be built
* @param p1 graphics for waypoint type, bit 8 signifies custom waypoint gfx (& 0x100)
* @param p2 unused
+ *
+ * @todo When checking for the tile slope,
+ * distingush between "Flat land required" and "land sloped in wrong direction"
*/
int32 CmdBuildTrainWaypoint(int x, int y, uint32 flags, uint32 p1, uint32 p2)
{
@@ -175,7 +178,7 @@ int32 CmdBuildTrainWaypoint(int x, int y, uint32 flags, uint32 p1, uint32 p2)
tileh = GetTileSlope(tile, NULL);
if (tileh != 0) {
- if (!_patches.build_on_slopes || tileh & 0x10 || !(tileh & (0x3 << dir)) || !(tileh & ~(0x3 << dir)))
+ if (!_patches.build_on_slopes || IsSteepTileh(tileh) || !(tileh & (0x3 << dir)) || !(tileh & ~(0x3 << dir)))
return_cmd_error(STR_0007_FLAT_LAND_REQUIRED);
}