2 * This file is part of OpenTTD.
3 * 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.
4 * 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.
5 * 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/>.
9 * @file script_types.hpp Defines all the types of the game, like IDs of various objects.
11 * IDs are used to identify certain objects. They are only unique within the object type, so for example a vehicle may have VehicleID 2009,
12 * while a station has StationID 2009 at the same time. Also IDs are assigned arbitrary, you cannot assume them to be consecutive.
13 * Also note that some IDs are static and never change, while others are allocated dynamically and might be
14 * reused for other objects once they are released. So be careful, which IDs you store for which purpose and whether they stay valid all the time.
17 * <tr><th>type </th><th> object </th>
20 * <th> reused </th></tr>
21 * <tr><td>#BridgeID </td><td> bridge type </td>
22 * <td> introduction \ref newgrf_changes "(1)" </td>
23 * <td> never \ref newgrf_changes "(1)" </td>
24 * <td> no \ref newgrf_changes "(1)" </td></tr>
25 * <tr><td>#CargoID </td><td> cargo type </td>
26 * <td> game start \ref newgrf_changes "(1)" </td>
27 * <td> never \ref newgrf_changes "(1)" </td>
28 * <td> no \ref newgrf_changes "(1)" </td></tr>
29 * <tr><td>#EngineID </td><td> engine type </td>
30 * <td> introduction, preview \ref dynamic_engines "(2)" </td>
31 * <td> engines retires \ref dynamic_engines "(2)" </td>
32 * <td> no \ref dynamic_engines "(2)" </td></tr>
33 * <tr><td>#GoalID </td><td> goal </td>
37 * <tr><td>#GroupID </td><td> vehicle group </td>
41 * <tr><td>#IndustryID </td><td> industry </td>
42 * <td> construction </td>
45 * <tr><td>#IndustryType</td><td> industry type </td>
46 * <td> game start \ref newgrf_changes "(1)" </td>
47 * <td> never \ref newgrf_changes "(1)" </td>
49 * <tr><td>#SignID </td><td> sign </td>
50 * <td> construction </td>
53 * <tr><td>#StationID </td><td> station </td>
54 * <td> construction </td>
55 * <td> expiration of 'grey' station sign after deletion </td>
57 * <tr><td>#SubsidyID </td><td> subsidy </td>
58 * <td> offer announcement </td>
59 * <td> (offer) expiration </td>
61 * <tr><td>#TileIndex </td><td> tile on map </td>
62 * <td> game start </td>
65 * <tr><td>#TownID </td><td> town </td>
66 * <td> game start </td>
69 * <tr><td>#VehicleID </td><td> vehicle </td>
70 * <td> construction, autorenew, autoreplace </td>
71 * <td> destruction, autorenew, autoreplace </td>
76 * \li \anchor newgrf_changes (1) in-game changes of newgrfs may reassign/invalidate IDs (will also cause other trouble though).
77 * \li \anchor dynamic_engines (2) engine IDs are reassigned/invalidated on changing 'allow multiple newgrf engine sets' (only allowed as long as no vehicles are built).
80 #ifndef SCRIPT_TYPES_HPP
81 #define SCRIPT_TYPES_HPP
83 #include "../../core/overflowsafe_type.hpp"
84 #include "../../company_type.h"
85 #include "../../tile_type.h"
88 /* Define all types here, so we don't have to include the whole _type.h maze */
89 typedef uint BridgeType
; ///< Internal name, not of any use for you.
90 typedef byte CargoID
; ///< The ID of a cargo.
91 class CommandCost
; ///< The cost of a command.
92 typedef uint16_t EngineID
; ///< The ID of an engine.
93 typedef uint16_t GoalID
; ///< The ID of a goal.
94 typedef uint16_t GroupID
; ///< The ID of a group.
95 typedef uint16_t IndustryID
; ///< The ID of an industry.
96 typedef uint8_t IndustryType
; ///< The ID of an industry-type.
97 typedef OverflowSafeInt64 Money
; ///< Money, stored in a 32bit/64bit safe way. For scripts money is always in pounds.
98 typedef uint16_t SignID
; ///< The ID of a sign.
99 typedef uint16_t StationID
; ///< The ID of a station.
100 typedef uint32_t StringID
; ///< The ID of a string.
101 typedef uint16_t SubsidyID
; ///< The ID of a subsidy.
102 typedef uint16_t StoryPageID
; ///< The ID of a story page.
103 typedef uint16_t StoryPageElementID
; ///< The ID of a story page element.
104 typedef uint16_t TownID
; ///< The ID of a town.
105 typedef uint32_t VehicleID
; ///< The ID of a vehicle.
107 /* Types we defined ourself, as the OpenTTD core doesn't have them (yet) */
108 typedef uint ScriptErrorType
;///< The types of errors inside the script framework.
109 typedef BridgeType BridgeID
; ///< The ID of a bridge.
111 #endif /* SCRIPT_TYPES_HPP */