script_waypoint.hpp

Go to the documentation of this file.
00001 /* $Id: script_waypoint.hpp 23615 2011-12-19 20:57:34Z truebrain $ */
00002 
00003 /*
00004  * This file is part of OpenTTD.
00005  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
00006  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00007  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
00008  */
00009 
00012 #ifndef SCRIPT_WAYPOINT_HPP
00013 #define SCRIPT_WAYPOINT_HPP
00014 
00015 #include "script_basestation.hpp"
00016 #include "../../station_type.h"
00017 
00022 class ScriptWaypoint : public ScriptBaseStation {
00023 public:
00027   enum ErrorMessages {
00029     ERR_WAYPOINT_BASE = ScriptError::ERR_CAT_WAYPOINT << ScriptError::ERR_CAT_BIT_SIZE,
00030 
00032     ERR_WAYPOINT_TOO_CLOSE_TO_ANOTHER_WAYPOINT, // [STR_ERROR_TOO_CLOSE_TO_ANOTHER_WAYPOINT]
00033 
00035     ERR_WAYPOINT_ADJOINS_MULTIPLE_WAYPOINTS,    // [STR_ERROR_WAYPOINT_ADJOINS_MORE_THAN_ONE_EXISTING]
00036   };
00037 
00041   enum WaypointType {
00042     /* Note: these values represent part of the in-game StationFacility enum */
00043     WAYPOINT_RAIL      = ::FACIL_TRAIN, 
00044     WAYPOINT_BUOY      = ::FACIL_DOCK,  
00045     WAYPOINT_ANY       = WAYPOINT_RAIL | WAYPOINT_BUOY, 
00046   };
00047 
00053   static bool IsValidWaypoint(StationID waypoint_id);
00054 
00061   static StationID GetWaypointID(TileIndex tile);
00062 
00069   static bool HasWaypointType(StationID waypoint_id, WaypointType waypoint_type);
00070 };
00071 
00072 DECLARE_ENUM_AS_BIT_SET(ScriptWaypoint::WaypointType)
00073 
00074 #endif /* SCRIPT_WAYPOINT_HPP */