Mercurial > hg > openttd
changeset 16209:f94968aadc35 draft
(svn r20909) -Fix [FS#4137]: don't see coasts as water for object construction
author | rubidium <rubidium@openttd.org> |
---|---|
date | Fri, 08 Oct 2010 21:08:38 +0000 |
parents | bd3841c2874e |
children | d48edf452478 |
files | src/object_cmd.cpp src/water_map.h |
diffstat | 2 files changed, 11 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/object_cmd.cpp +++ b/src/object_cmd.cpp @@ -166,7 +166,7 @@ bool allow_water = (spec->flags & (OBJECT_FLAG_BUILT_ON_WATER | OBJECT_FLAG_NOT_ON_LAND)) != 0; bool allow_ground = (spec->flags & OBJECT_FLAG_NOT_ON_LAND) == 0; TILE_AREA_LOOP(t, ta) { - if (HasTileWaterClass(t) && IsTileOnWater(t)) { + if (HasTileWaterClass(t) && IsTileOnWater(t) && !IsCoastTile(t)) { if (!allow_water) return_cmd_error(STR_ERROR_CAN_T_BUILD_ON_WATER); if (!IsWaterTile(t)) { /* Normal water tiles don't have to be cleared. For all other tile types clear
--- a/src/water_map.h +++ b/src/water_map.h @@ -171,6 +171,16 @@ } /** + * Is it a coast tile + * @param t Tile to query. + * @return \c true if it is a coast. + */ +static inline bool IsCoastTile(TileIndex t) +{ + return IsTileType(t, MP_WATER) && IsCoast(t); +} + +/** * Get the other tile of the ship depot. * @param t Tile to query, containing one section of a ship depot. * @return Tile containing the other section of the depot.