From 1ed599f5cf6a0dec14d91d5442a08560e254d35c Mon Sep 17 00:00:00 2001 From: frosch Date: Mon, 4 Jan 2010 19:42:29 +0000 Subject: (svn r18725) -Add: [NoAI] AIWaypoint::WaypointType and AIWaypoint::HasWaypointType(). -Change: [NoAI] Constructor of AIWaypoint now takes a WaypointType to also handle buoys. -Remove: [NoAI] AIBuoyList. --- src/ai/api/ai_waypoint.hpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/ai/api/ai_waypoint.hpp') diff --git a/src/ai/api/ai_waypoint.hpp b/src/ai/api/ai_waypoint.hpp index a781a0ba9..ddd6168d5 100644 --- a/src/ai/api/ai_waypoint.hpp +++ b/src/ai/api/ai_waypoint.hpp @@ -23,6 +23,16 @@ class AIWaypoint : public AIBaseStation { public: static const char *GetClassName() { return "AIWaypoint"; } + /** + * Type of waypoints known in the game. + */ + enum WaypointType { + /* Values are important, as they represent the internal state of the game. */ + WAYPOINT_RAIL = 0x01, //!< Rail waypoint + WAYPOINT_BUOY = 0x10, //!< Buoy + WAYPOINT_ANY = 0x11, //!< All waypoint types + }; + /** * All waypoint related error messages. */ @@ -51,6 +61,16 @@ public: * @return StationID of the waypoint. */ static StationID GetWaypointID(TileIndex tile); + + /** + * Check if any part of the waypoint contains a waypoint of the type waypoint_type + * @param waypoint_id The waypoint to look at. + * @param waypoint_type The WaypointType to look for. + * @return True if the waypoint has a waypoint part of the type waypoint_type. + */ + static bool HasWaypointType(StationID waypoint_id, WaypointType waypoint_type); }; +DECLARE_ENUM_AS_BIT_SET(AIWaypoint::WaypointType); + #endif /* AI_WAYPOINT_HPP */ -- cgit v1.2.3-54-g00ecf