1 /* $Id: script_basestation.hpp 26307 2014-02-06 19:50:34Z zuu $ */
4 * This file is part of OpenTTD.
5 * 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.
6 * 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.
7 * 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/>.
10 /** @file script_basestation.hpp Base for stations/waypoint handling. */
12 #ifndef SCRIPT_BASESTATION_HPP
13 #define SCRIPT_BASESTATION_HPP
15 #include "script_text.hpp"
16 #include "script_date.hpp"
19 * Base class for stations and waypoints.
22 class ScriptBaseStation
: public ScriptObject
{
25 * Special station IDs for building adjacent/new stations when
26 * the adjacent/distant join features are enabled.
28 enum SpecialStationIDs
{
29 STATION_NEW
= 0xFFFD, ///< Build a new station
30 STATION_JOIN_ADJACENT
= 0xFFFE, ///< Join an neighbouring station if one exists
31 STATION_INVALID
= 0xFFFF, ///< Invalid station id.
35 * Checks whether the given basestation is valid and owned by you.
36 * @param station_id The station to check.
37 * @return True if and only if the basestation is valid.
38 * @note IsValidBaseStation == (IsValidStation || IsValidWaypoint).
40 static bool IsValidBaseStation(StationID station_id
);
43 * Get the name of a basestation.
44 * @param station_id The basestation to get the name of.
45 * @pre IsValidBaseStation(station_id).
46 * @return The name of the station.
48 static char *GetName(StationID station_id
);
51 * Set the name this basestation.
52 * @param station_id The basestation to set the name of.
53 * @param name The new name of the station (can be either a raw string, or a ScriptText object).
54 * @pre IsValidBaseStation(station_id).
55 * @pre name != NULL && len(name) != 0.
56 * @game @pre Valid ScriptCompanyMode active in scope.
57 * @exception ScriptError::ERR_NAME_IS_NOT_UNIQUE
58 * @return True if the name was changed.
60 static bool SetName(StationID station_id
, Text
*name
);
63 * Get the current location of a basestation.
64 * @param station_id The basestation to get the location of.
65 * @pre IsValidBaseStation(station_id).
66 * @return The tile the basestation sign above it.
67 * @note The tile is not necessarily a station tile (and if it is, it could also belong to another station).
68 * @see ScriptTileList_StationType.
70 static TileIndex
GetLocation(StationID station_id
);
73 * Get the last date a station part was added to this station.
74 * @param station_id The station to look at.
75 * @return The last date some part of this station was build.
77 static ScriptDate::Date
GetConstructionDate(StationID station_id
);
80 #endif /* SCRIPT_BASESTATION_HPP */