7 |
7 |
8 #include "engine.h" |
8 #include "engine.h" |
9 #include "newgrf_cargo.h" |
9 #include "newgrf_cargo.h" |
10 #include "helpers.hpp" |
10 #include "helpers.hpp" |
11 |
11 |
12 typedef enum { |
12 enum StationClassID { |
13 STAT_CLASS_BEGIN = 0, ///< the lowest valid value |
13 STAT_CLASS_BEGIN = 0, ///< the lowest valid value |
14 STAT_CLASS_DFLT = 0, ///< Default station class. |
14 STAT_CLASS_DFLT = 0, ///< Default station class. |
15 STAT_CLASS_WAYP, ///< Waypoint class. |
15 STAT_CLASS_WAYP, ///< Waypoint class. |
16 STAT_CLASS_MAX = 32, ///< Maximum number of classes. |
16 STAT_CLASS_MAX = 32, ///< Maximum number of classes. |
17 } StationClassID; |
17 }; |
18 |
18 |
19 /** Define basic enum properties */ |
19 /** Define basic enum properties */ |
20 template <> struct EnumPropsT<StationClassID> : MakeEnumPropsT<StationClassID, byte, STAT_CLASS_BEGIN, STAT_CLASS_MAX, STAT_CLASS_MAX> {}; |
20 template <> struct EnumPropsT<StationClassID> : MakeEnumPropsT<StationClassID, byte, STAT_CLASS_BEGIN, STAT_CLASS_MAX, STAT_CLASS_MAX> {}; |
21 typedef TinyEnumT<StationClassID> StationClassIDByte; |
21 typedef TinyEnumT<StationClassID> StationClassIDByte; |
22 |
22 |
25 |
25 |
26 /* Station layout for given dimensions - it is a two-dimensional array |
26 /* Station layout for given dimensions - it is a two-dimensional array |
27 * where index is computed as (x * platforms) + platform. */ |
27 * where index is computed as (x * platforms) + platform. */ |
28 typedef byte *StationLayout; |
28 typedef byte *StationLayout; |
29 |
29 |
30 typedef struct StationSpec { |
30 struct StationSpec { |
31 uint32 grfid; ///< ID of GRF file station belongs to. |
31 uint32 grfid; ///< ID of GRF file station belongs to. |
32 int localidx; ///< Index within GRF file of station. |
32 int localidx; ///< Index within GRF file of station. |
33 |
33 |
34 bool allocated; ///< Flag whether this station has been added to a station class list |
34 bool allocated; ///< Flag whether this station has been added to a station class list |
35 |
35 |
82 * NUM_CARGO real cargo plus three pseudo cargo sprite groups. |
82 * NUM_CARGO real cargo plus three pseudo cargo sprite groups. |
83 * Used for obtaining the sprite offset of custom sprites, and for |
83 * Used for obtaining the sprite offset of custom sprites, and for |
84 * evaluating callbacks. |
84 * evaluating callbacks. |
85 */ |
85 */ |
86 const struct SpriteGroup *spritegroup[NUM_CARGO + 3]; |
86 const struct SpriteGroup *spritegroup[NUM_CARGO + 3]; |
87 } StationSpec; |
87 }; |
88 |
88 |
89 /** |
89 /** |
90 * Struct containing information relating to station classes. |
90 * Struct containing information relating to station classes. |
91 */ |
91 */ |
92 typedef struct StationClass { |
92 struct StationClass { |
93 uint32 id; ///< ID of this class, e.g. 'DFLT', 'WAYP', etc. |
93 uint32 id; ///< ID of this class, e.g. 'DFLT', 'WAYP', etc. |
94 StringID name; ///< Name of this class. |
94 StringID name; ///< Name of this class. |
95 uint stations; ///< Number of stations in this class. |
95 uint stations; ///< Number of stations in this class. |
96 StationSpec **spec; ///< Array of station specifications. |
96 StationSpec **spec; ///< Array of station specifications. |
97 } StationClass; |
97 }; |
98 |
98 |
99 void ResetStationClasses(); |
99 void ResetStationClasses(); |
100 StationClassID AllocateStationClass(uint32 cls); |
100 StationClassID AllocateStationClass(uint32 cls); |
101 void SetStationClassName(StationClassID sclass, StringID name); |
101 void SetStationClassName(StationClassID sclass, StringID name); |
102 StringID GetStationClassName(StationClassID sclass); |
102 StringID GetStationClassName(StationClassID sclass); |