From c0e7ddeb9ee8892103a1314dac25e0d7250e6af4 Mon Sep 17 00:00:00 2001 From: yexo Date: Thu, 19 Feb 2009 07:40:08 +0000 Subject: (svn r15519) -Add [NoAI]: support for waypoints by adding AIRail::Build/Remove RailWaypoint, AIWaypoint and AIWaypointList. --- src/ai/api/ai_waypoint.hpp | 66 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 src/ai/api/ai_waypoint.hpp (limited to 'src/ai/api/ai_waypoint.hpp') diff --git a/src/ai/api/ai_waypoint.hpp b/src/ai/api/ai_waypoint.hpp new file mode 100644 index 000000000..69eacb10e --- /dev/null +++ b/src/ai/api/ai_waypoint.hpp @@ -0,0 +1,66 @@ +/* $Id$ */ + +/** @file ai_waypoint.hpp Everything to query and build waypoints. */ + +#ifndef AI_WAYPOINT_HPP +#define AI_WAYPOINT_HPP + +#include "ai_object.hpp" +#include "ai_error.hpp" + +/** + * Class that handles all waypoint related functions. + */ +class AIWaypoint : public AIObject { +public: + static const char *GetClassName() { return "AIWaypoint"; } + + enum SpecialWaypointIDs { + WAYPOINT_INVALID = -1, //!< An invalid WaypointID. + }; + + /** + * Checks whether the given waypoint is valid and owned by you. + * @param waypoint_id The waypoint to check. + * @return True if and only if the waypoint is valid. + */ + static bool IsValidWaypoint(WaypointID waypoint_id); + + /** + * Get the WaypointID of a tile. + * @param tile The tile to find the WaypointID of. + * @pre AIRail::IsRailWaypointTile(tile). + * @return WaypointID of the waypoint. + */ + static WaypointID GetWaypointID(TileIndex tile); + + /** + * Get the name of a waypoint. + * @param waypoint_id The waypoint to get the name of. + * @pre IsValidWaypoint(waypoint_id). + * @return The name of the waypoint. + */ + static char *GetName(WaypointID waypoint_id); + + /** + * Set the name this waypoint. + * @param waypoint_id The waypoint to set the name of. + * @param name The new name of the waypoint. + * @pre IsValidWaypointwaypoint_id). + * @pre 'name' must have at least one character. + * @pre 'name' must have at most 30 characters. + * @exception AIError::ERR_NAME_IS_NOT_UNIQUE + * @return True if the name was changed. + */ + static bool SetName(WaypointID waypoint_id, const char *name); + + /** + * Get the current location of a waypoint. + * @param waypoint_id The waypoint to get the location of. + * @pre IsValidWaypoint(waypoint_id). + * @return The tile the waypoint is currently on. + */ + static TileIndex GetLocation(WaypointID waypoint_id); +}; + +#endif /* AI_WAYPOINT_HPP */ -- cgit v1.2.3-54-g00ecf