From 7bbc19288f33a2c68daebdc9c31de84ef91e37c9 Mon Sep 17 00:00:00 2001 From: rubidium Date: Fri, 8 Oct 2010 21:08:38 +0000 Subject: (svn r20909) -Fix [FS#4137]: don't see coasts as water for object construction --- src/object_cmd.cpp | 2 +- src/water_map.h | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/object_cmd.cpp b/src/object_cmd.cpp index cedec4188..0ddcf3664 100644 --- a/src/object_cmd.cpp +++ b/src/object_cmd.cpp @@ -166,7 +166,7 @@ CommandCost CmdBuildObject(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3 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 diff --git a/src/water_map.h b/src/water_map.h index 07819e182..41a903dd3 100644 --- a/src/water_map.h +++ b/src/water_map.h @@ -170,6 +170,16 @@ static inline bool IsCoast(TileIndex t) return GetWaterTileType(t) == WATER_TILE_COAST; } +/** + * 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. -- cgit v1.2.3-70-g09d2