diff options
author | celestar <celestar@openttd.org> | 2005-07-16 23:47:37 +0000 |
---|---|---|
committer | celestar <celestar@openttd.org> | 2005-07-16 23:47:37 +0000 |
commit | 9ca761b06534ed191b0624a6c7049db296997a73 (patch) | |
tree | b32b3e56573203f32982f2fc2b3966529a6d1857 /station_cmd.c | |
parent | 64f6839816221873b9a5327fe038533a7d3b8a98 (diff) | |
download | openttd-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 'station_cmd.c')
-rw-r--r-- | station_cmd.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/station_cmd.c b/station_cmd.c index c39a832e7..3dcd34b2f 100644 --- a/station_cmd.c +++ b/station_cmd.c @@ -764,8 +764,18 @@ int32 CheckFlatLandBelow(TileIndex tile, uint w, uint h, uint flags, uint invali tileh = GetTileSlope(tile_cur, &z); - // steep slopes are completely prohibited - if (tileh & 0x10 || (((!_patches.ainew_active && _is_ai_player) || !_patches.build_on_slopes) && tileh != 0)) { + /* Prohibit building if + 1) The tile is "steep" (i.e. stretches two height levels) + -OR- + 2) The tile is non-flat if + a) the player building is an "old-school" AI + -OR- + b) the build_on_slopes switch is disabled + */ + if (IsSteepTileh(tileh) || + (((!_patches.ainew_active && _is_ai_player) || !_patches.build_on_slopes) + && tileh != 0)) { + _error_message = STR_0007_FLAT_LAND_REQUIRED; return CMD_ERROR; } |