author | peter1138 |
Tue, 02 May 2006 20:48:27 +0000 | |
changeset 3725 | 1b5ce8c7b51f |
parent 3688 | c3bc748056d0 |
child 3740 | 00a9594628b1 |
permissions | -rw-r--r-- |
2625
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
1 |
/* $Id$ */ |
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
2 |
|
2963
6645da0a5b4a
(svn r3525) - Rename station_newgrf.[ch] to newgrf_station.[ch], and update project files.
peter1138
parents:
2625
diff
changeset
|
3 |
/** @file newgrf_station.h Header file for NewGRF stations */ |
2625
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
4 |
|
2963
6645da0a5b4a
(svn r3525) - Rename station_newgrf.[ch] to newgrf_station.[ch], and update project files.
peter1138
parents:
2625
diff
changeset
|
5 |
#ifndef NEWGRF_STATION_H |
6645da0a5b4a
(svn r3525) - Rename station_newgrf.[ch] to newgrf_station.[ch], and update project files.
peter1138
parents:
2625
diff
changeset
|
6 |
#define NEWGRF_STATION_H |
2625
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
7 |
|
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
8 |
#include "engine.h" |
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
9 |
|
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
10 |
typedef enum { |
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
11 |
STAT_CLASS_DFLT, ///< Default station class. |
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
12 |
STAT_CLASS_WAYP, ///< Waypoint class. |
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
13 |
STAT_CLASS_MAX = 16, ///< Maximum number of classes. |
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
14 |
} StationClassID; |
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
15 |
|
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
16 |
/* Station layout for given dimensions - it is a two-dimensional array |
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
17 |
* where index is computed as (x * platforms) + platform. */ |
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
18 |
typedef byte *StationLayout; |
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
19 |
|
3688
c3bc748056d0
(svn r4613) - NewGRF: fix two struct declarations
peter1138
parents:
3676
diff
changeset
|
20 |
typedef struct StationSpec { |
2625
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
21 |
uint32 grfid; ///< ID of GRF file station belongs to. |
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
22 |
int localidx; ///< Index within GRF file of station. |
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
23 |
|
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
24 |
StationClassID sclass; ///< The class to which this spec belongs. |
3594
31fd59e606c8
(svn r4484) - Newstations: Use StringIDs instead of char*s to reference our custom names.
peter1138
parents:
3587
diff
changeset
|
25 |
StringID name; ///< Name of this station. |
2625
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
26 |
|
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
27 |
/** |
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
28 |
* Bitmask of number of platforms available for the station. |
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
29 |
* 0..6 correpsond to 1..7, while bit 7 corresponds to >7 platforms. |
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
30 |
*/ |
3505
e9a3a6b79561
(svn r4356) - NewGRF: Load more newstation properties.
peter1138
parents:
2967
diff
changeset
|
31 |
byte disallowed_platforms; |
2625
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
32 |
/** |
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
33 |
* Bitmask of platform lengths available for the station. |
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
34 |
* 0..6 correpsond to 1..7, while bit 7 corresponds to >7 tiles long. |
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
35 |
*/ |
3505
e9a3a6b79561
(svn r4356) - NewGRF: Load more newstation properties.
peter1138
parents:
2967
diff
changeset
|
36 |
byte disallowed_lengths; |
2625
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
37 |
|
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
38 |
/** Number of tile layouts. |
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
39 |
* A minimum of 8 is required is required for stations. |
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
40 |
* 0-1 = plain platform |
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
41 |
* 2-3 = platform with building |
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
42 |
* 4-5 = platform with roof, left side |
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
43 |
* 6-7 = platform with roof, right side |
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
44 |
*/ |
3570
f9749bae861e
(svn r4452) - NewGRF: switch to unsigned ints for array indices.
peter1138
parents:
3505
diff
changeset
|
45 |
uint tiles; |
2625
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
46 |
DrawTileSprites *renderdata; ///< Array of tile layouts. |
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
47 |
|
3505
e9a3a6b79561
(svn r4356) - NewGRF: Load more newstation properties.
peter1138
parents:
2967
diff
changeset
|
48 |
/** Cargo threshold for choosing between little and lots of cargo |
e9a3a6b79561
(svn r4356) - NewGRF: Load more newstation properties.
peter1138
parents:
2967
diff
changeset
|
49 |
* @note little/lots are equivalent to the moving/loading states for vehicles |
e9a3a6b79561
(svn r4356) - NewGRF: Load more newstation properties.
peter1138
parents:
2967
diff
changeset
|
50 |
*/ |
e9a3a6b79561
(svn r4356) - NewGRF: Load more newstation properties.
peter1138
parents:
2967
diff
changeset
|
51 |
uint16 cargo_threshold; |
e9a3a6b79561
(svn r4356) - NewGRF: Load more newstation properties.
peter1138
parents:
2967
diff
changeset
|
52 |
|
e9a3a6b79561
(svn r4356) - NewGRF: Load more newstation properties.
peter1138
parents:
2967
diff
changeset
|
53 |
uint32 cargo_triggers; ///< Bitmask of cargo types which cause trigger re-randomizing |
e9a3a6b79561
(svn r4356) - NewGRF: Load more newstation properties.
peter1138
parents:
2967
diff
changeset
|
54 |
|
e9a3a6b79561
(svn r4356) - NewGRF: Load more newstation properties.
peter1138
parents:
2967
diff
changeset
|
55 |
byte callbackmask; ///< Bitmask of callbacks to use, @see newgrf_callbacks.h |
e9a3a6b79561
(svn r4356) - NewGRF: Load more newstation properties.
peter1138
parents:
2967
diff
changeset
|
56 |
|
e9a3a6b79561
(svn r4356) - NewGRF: Load more newstation properties.
peter1138
parents:
2967
diff
changeset
|
57 |
byte flags; ///< Bitmask of flags, bit 0: use different sprite set; bit 1: divide cargo about by station size |
e9a3a6b79561
(svn r4356) - NewGRF: Load more newstation properties.
peter1138
parents:
2967
diff
changeset
|
58 |
|
e9a3a6b79561
(svn r4356) - NewGRF: Load more newstation properties.
peter1138
parents:
2967
diff
changeset
|
59 |
byte pylons; ///< Bitmask of base tiles (0 - 7) which should contain elrail pylons |
e9a3a6b79561
(svn r4356) - NewGRF: Load more newstation properties.
peter1138
parents:
2967
diff
changeset
|
60 |
byte wires; ///< Bitmask of base tiles (0 - 7) which should contain elrail wires |
e9a3a6b79561
(svn r4356) - NewGRF: Load more newstation properties.
peter1138
parents:
2967
diff
changeset
|
61 |
byte blocked; ///< Bitmask of base tiles (0 - 7) which are blocked to trains |
e9a3a6b79561
(svn r4356) - NewGRF: Load more newstation properties.
peter1138
parents:
2967
diff
changeset
|
62 |
|
2625
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
63 |
byte lengths; |
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
64 |
byte *platforms; |
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
65 |
StationLayout **layouts; |
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
66 |
|
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
67 |
/** |
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
68 |
* NUM_GLOBAL_CID sprite groups. |
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
69 |
* Used for obtaining the sprite offset of custom sprites, and for |
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
70 |
* evaluating callbacks. |
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
71 |
*/ |
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
72 |
SpriteGroup *spritegroup[NUM_GLOBAL_CID]; |
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
73 |
} StationSpec; |
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
74 |
|
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
75 |
/** |
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
76 |
* Struct containing information relating to station classes. |
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
77 |
*/ |
3688
c3bc748056d0
(svn r4613) - NewGRF: fix two struct declarations
peter1138
parents:
3676
diff
changeset
|
78 |
typedef struct StationClass { |
2625
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
79 |
uint32 id; ///< ID of this class, e.g. 'DFLT', 'WAYP', etc. |
3594
31fd59e606c8
(svn r4484) - Newstations: Use StringIDs instead of char*s to reference our custom names.
peter1138
parents:
3587
diff
changeset
|
80 |
StringID name; ///< Name of this class. |
2625
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
81 |
uint stations; ///< Number of stations in this class. |
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
82 |
StationSpec **spec; ///< Array of station specifications. |
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
83 |
} StationClass; |
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
84 |
|
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
85 |
void ResetStationClasses(void); |
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
86 |
StationClassID AllocateStationClass(uint32 class); |
3642
a247e07fafdf
(svn r4551) - NewGRF: add string handling for newstations.
peter1138
parents:
3594
diff
changeset
|
87 |
void SetStationClassName(StationClassID sclass, StringID name); |
a247e07fafdf
(svn r4551) - NewGRF: add string handling for newstations.
peter1138
parents:
3594
diff
changeset
|
88 |
StringID GetStationClassName(StationClassID sclass); |
a247e07fafdf
(svn r4551) - NewGRF: add string handling for newstations.
peter1138
parents:
3594
diff
changeset
|
89 |
StringID *BuildStationClassDropdown(void); |
a247e07fafdf
(svn r4551) - NewGRF: add string handling for newstations.
peter1138
parents:
3594
diff
changeset
|
90 |
|
3587 | 91 |
uint GetNumStationClasses(void); |
2625
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
92 |
uint GetNumCustomStations(StationClassID sclass); |
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
93 |
|
3676
48444d881fbe
(svn r4593) CodeChange : Renamed spec (when using StationSpec) to statspec.
belugas
parents:
3642
diff
changeset
|
94 |
void SetCustomStationSpec(StationSpec *statspec); |
48444d881fbe
(svn r4593) CodeChange : Renamed spec (when using StationSpec) to statspec.
belugas
parents:
3642
diff
changeset
|
95 |
const StationSpec *GetCustomStationSpec(StationClassID sclass, uint station); |
2625
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff
changeset
|
96 |
|
2967
4208a82bf0d9
(svn r3530) - NewGRF: Move station resolver to newgrf_station
peter1138
parents:
2963
diff
changeset
|
97 |
/* Get sprite offset for a given custom station and station structure (may be |
4208a82bf0d9
(svn r3530) - NewGRF: Move station resolver to newgrf_station
peter1138
parents:
2963
diff
changeset
|
98 |
* NULL if ctype is set - that means we are in a build dialog). The station |
4208a82bf0d9
(svn r3530) - NewGRF: Move station resolver to newgrf_station
peter1138
parents:
2963
diff
changeset
|
99 |
* structure is used for variational sprite groups. */ |
3676
48444d881fbe
(svn r4593) CodeChange : Renamed spec (when using StationSpec) to statspec.
belugas
parents:
3642
diff
changeset
|
100 |
uint32 GetCustomStationRelocation(const StationSpec *statspec, const Station *st, byte ctype); |
2967
4208a82bf0d9
(svn r3530) - NewGRF: Move station resolver to newgrf_station
peter1138
parents:
2963
diff
changeset
|
101 |
|
3587 | 102 |
/* Allocate a StationSpec to a Station. This is called once per build operation. */ |
3676
48444d881fbe
(svn r4593) CodeChange : Renamed spec (when using StationSpec) to statspec.
belugas
parents:
3642
diff
changeset
|
103 |
int AllocateSpecToStation(const StationSpec *statspec, Station *st, bool exec); |
3587 | 104 |
|
105 |
/* Deallocate a StationSpec from a Station. Called when removing a single station tile. */ |
|
106 |
bool DeallocateSpecFromStation(Station *st, byte specindex); |
|
107 |
||
2963
6645da0a5b4a
(svn r3525) - Rename station_newgrf.[ch] to newgrf_station.[ch], and update project files.
peter1138
parents:
2625
diff
changeset
|
108 |
#endif /* NEWGRF_STATION_H */ |