diff -r 6e4a90ed8830 -r da75d1460a4b src/ai/api/ai_tile.hpp --- a/src/ai/api/ai_tile.hpp Tue Apr 15 15:34:02 2008 +0000 +++ b/src/ai/api/ai_tile.hpp Tue Apr 15 16:11:29 2008 +0000 @@ -58,7 +58,9 @@ SLOPE_STEEP_W = SLOPE_STEEP | SLOPE_NWS, //!< A steep slope falling to east (from west) SLOPE_STEEP_S = SLOPE_STEEP | SLOPE_WSE, //!< A steep slope falling to north (from south) SLOPE_STEEP_E = SLOPE_STEEP | SLOPE_SEN, //!< A steep slope falling to west (from east) - SLOPE_STEEP_N = SLOPE_STEEP | SLOPE_ENW //!< A steep slope falling to south (from north) + SLOPE_STEEP_N = SLOPE_STEEP | SLOPE_ENW, //!< A steep slope falling to south (from north) + + SLOPE_INVALID = 0xFF, //!< An invalid slope }; /** @@ -92,12 +94,39 @@ static bool IsWater(TileIndex tile); /** + * Check if a tile has a steep slope. + * @param slope The slope to check on. + * @pre slope != SLOPE_INVALID. + * @return True if the slope is a steep slope. + */ + static bool IsSteepSlope(Slope slope); + + /** + * Check if a tile has a halftile slope. + * @param slope The slope to check on. + * @pre slope != SLOPE_INVALID. + * @return True if the slope is a halftile slope. + */ + static bool IsHalftileSlope(Slope slope); + + /** * Get the slope of a tile. * @param tile The tile to check on. * @pre AIMap::IsValidTile(tile). * @return 0 means flat, others indicate internal state of slope. */ - static int32 GetSlope(TileIndex tile); + static Slope GetSlope(TileIndex tile); + + /** + * Get the complement of the slope. + * @param slope The slope to get the complement of. + * @pre slope != SLOPE_INVALID. + * @pre !IsSteepSlope(slope). + * @pre !IsHalftileSlope(slope). + * @return The complement of a slope. This means that all corners that + * weren't raised, are raised, and visa versa. + */ + static Slope GetComplementSlope(Slope slope); /** * Get the height of the tile.