author | darkvater |
Sun, 14 Nov 2004 16:42:08 +0000 | |
changeset 405 | 6830ae7a0d5d |
parent 403 | bfb365c74e80 |
child 408 | 63a8c0505aab |
permissions | -rw-r--r-- |
0 | 1 |
#ifndef STATION_H |
2 |
#define STATION_H |
|
3 |
||
405
6830ae7a0d5d
(svn r602) -newgrf: Move DrawTileSeqStruct & co and struct SpriteGroup to sprite.h (pasky)
darkvater
parents:
403
diff
changeset
|
4 |
#include "sprite.h" |
0 | 5 |
#include "vehicle.h" |
6 |
||
7 |
typedef struct GoodsEntry { |
|
8 |
uint16 waiting_acceptance; |
|
9 |
byte days_since_pickup; |
|
10 |
byte rating; |
|
11 |
byte enroute_from; |
|
12 |
byte enroute_time; |
|
13 |
byte last_speed; |
|
14 |
byte last_age; |
|
15 |
} GoodsEntry; |
|
16 |
||
17 |
struct Station { |
|
18 |
TileIndex xy; |
|
19 |
TileIndex bus_tile; |
|
20 |
TileIndex lorry_tile; |
|
21 |
TileIndex train_tile; |
|
22 |
TileIndex airport_tile; |
|
23 |
TileIndex dock_tile; |
|
24 |
Town *town; |
|
25 |
// alpha_order is obsolete since savegame format 4 |
|
26 |
byte alpha_order_obsolete; |
|
27 |
uint16 string_id; |
|
28 |
||
29 |
ViewportSign sign; |
|
30 |
||
31 |
uint16 had_vehicle_of_type; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
123
diff
changeset
|
32 |
|
0 | 33 |
byte time_since_load; |
34 |
byte time_since_unload; |
|
35 |
byte delete_ctr; |
|
36 |
byte owner; |
|
37 |
byte facilities; |
|
38 |
byte airport_type; |
|
39 |
byte truck_stop_status; |
|
40 |
byte bus_stop_status; |
|
123
d550772c61e6
(svn r124) Prepared code for removal of block_months variable in next major savegame version
dominik
parents:
55
diff
changeset
|
41 |
byte blocked_months_obsolete; |
0 | 42 |
|
43 |
// trainstation width/height |
|
44 |
byte trainst_w, trainst_h; |
|
45 |
||
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
46 |
byte class_id; // custom graphics station class |
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
47 |
byte stat_id; // custom graphics station id in the @class_id class |
0 | 48 |
uint16 build_date; |
49 |
||
50 |
//uint16 airport_flags; |
|
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
51 |
uint32 airport_flags; |
0 | 52 |
uint16 index; |
53 |
||
54 |
VehicleID last_vehicle; |
|
55 |
GoodsEntry goods[NUM_CARGO]; |
|
56 |
}; |
|
57 |
||
58 |
enum { |
|
59 |
FACIL_TRAIN = 1, |
|
60 |
FACIL_TRUCK_STOP = 2, |
|
61 |
FACIL_BUS_STOP = 4, |
|
62 |
FACIL_AIRPORT = 8, |
|
63 |
FACIL_DOCK = 0x10, |
|
64 |
}; |
|
65 |
||
66 |
enum { |
|
67 |
// HVOT_PENDING_DELETE = 1<<0, // not needed anymore |
|
68 |
HVOT_TRAIN = 1<<1, |
|
69 |
HVOT_BUS = 1 << 2, |
|
70 |
HVOT_TRUCK = 1 << 3, |
|
71 |
HVOT_AIRCRAFT = 1<<4, |
|
72 |
HVOT_SHIP = 1 << 5, |
|
73 |
HVOT_BUOY = 1 << 6 |
|
74 |
}; |
|
75 |
||
76 |
void ModifyStationRatingAround(TileIndex tile, byte owner, int amount, uint radius); |
|
77 |
||
55
73fae6c6568e
(svn r56) Improved order checker + patch setting for it (celestar)
dominik
parents:
0
diff
changeset
|
78 |
TileIndex GetStationTileForVehicle(Vehicle *v, Station *st); |
73fae6c6568e
(svn r56) Improved order checker + patch setting for it (celestar)
dominik
parents:
0
diff
changeset
|
79 |
|
0 | 80 |
void ShowStationViewWindow(int station); |
81 |
void UpdateAllStationVirtCoord(); |
|
82 |
||
83 |
VARDEF Station _stations[250]; |
|
243
9a40daa560ae
(svn r244) -Fix: Stations were not sorted for non-player-0 players
darkvater
parents:
193
diff
changeset
|
84 |
VARDEF bool _station_sort_dirty[MAX_PLAYERS]; |
9a40daa560ae
(svn r244) -Fix: Stations were not sorted for non-player-0 players
darkvater
parents:
193
diff
changeset
|
85 |
VARDEF bool _global_station_sort_dirty; |
0 | 86 |
|
87 |
#define DEREF_STATION(i) (&_stations[i]) |
|
88 |
#define FOR_ALL_STATIONS(st) for(st=_stations; st != endof(_stations); st++) |
|
89 |
||
90 |
||
91 |
void GetProductionAroundTiles(uint *produced, uint tile, int w, int h); |
|
92 |
void GetAcceptanceAroundTiles(uint *accepts, uint tile, int w, int h); |
|
93 |
uint GetStationPlatforms(Station *st, uint tile); |
|
384
bf1303e754ff
(svn r576) -newgrf: Cleanup horrible table/(station|unmovable)_land.h DrawTileSeqStruct hacks needed for custom station supports (pasky)
darkvater
parents:
243
diff
changeset
|
94 |
|
bf1303e754ff
(svn r576) -newgrf: Cleanup horrible table/(station|unmovable)_land.h DrawTileSeqStruct hacks needed for custom station supports (pasky)
darkvater
parents:
243
diff
changeset
|
95 |
|
399
ad3dcbfd2d48
(svn r591) -newgrf: Store whole struct StationSpec in SetCustomStation(), not just the rendering data. This will be needed for variational stationspecs (pasky).
darkvater
parents:
393
diff
changeset
|
96 |
struct StationSpec { |
400
d0608455bb77
(svn r592) -newgrf: Dynamically allocate global custom station IDs (pasky).
darkvater
parents:
399
diff
changeset
|
97 |
uint32 grfid; |
d0608455bb77
(svn r592) -newgrf: Dynamically allocate global custom station IDs (pasky).
darkvater
parents:
399
diff
changeset
|
98 |
int localidx; // per-GRFFile station index + 1; SetCustomStation() takes care of this |
d0608455bb77
(svn r592) -newgrf: Dynamically allocate global custom station IDs (pasky).
darkvater
parents:
399
diff
changeset
|
99 |
|
399
ad3dcbfd2d48
(svn r591) -newgrf: Store whole struct StationSpec in SetCustomStation(), not just the rendering data. This will be needed for variational stationspecs (pasky).
darkvater
parents:
393
diff
changeset
|
100 |
uint32 classid; |
400
d0608455bb77
(svn r592) -newgrf: Dynamically allocate global custom station IDs (pasky).
darkvater
parents:
399
diff
changeset
|
101 |
|
399
ad3dcbfd2d48
(svn r591) -newgrf: Store whole struct StationSpec in SetCustomStation(), not just the rendering data. This will be needed for variational stationspecs (pasky).
darkvater
parents:
393
diff
changeset
|
102 |
byte tiles; |
ad3dcbfd2d48
(svn r591) -newgrf: Store whole struct StationSpec in SetCustomStation(), not just the rendering data. This will be needed for variational stationspecs (pasky).
darkvater
parents:
393
diff
changeset
|
103 |
DrawTileSprites renderdata[8]; |
403
bfb365c74e80
(svn r600) -newgrf: Relocation offset for custom station sprites is now stored separately, making it possible to show different sprites in waypoint selection dialog (pasky).
darkvater
parents:
400
diff
changeset
|
104 |
|
bfb365c74e80
(svn r600) -newgrf: Relocation offset for custom station sprites is now stored separately, making it possible to show different sprites in waypoint selection dialog (pasky).
darkvater
parents:
400
diff
changeset
|
105 |
/* Sprite offsets for renderdata->seq->image. relocation[0] is default |
bfb365c74e80
(svn r600) -newgrf: Relocation offset for custom station sprites is now stored separately, making it possible to show different sprites in waypoint selection dialog (pasky).
darkvater
parents:
400
diff
changeset
|
106 |
* whilst relocation[1] is "CID_PURCHASE". */ |
bfb365c74e80
(svn r600) -newgrf: Relocation offset for custom station sprites is now stored separately, making it possible to show different sprites in waypoint selection dialog (pasky).
darkvater
parents:
400
diff
changeset
|
107 |
struct SpriteGroup relocation[2]; |
399
ad3dcbfd2d48
(svn r591) -newgrf: Store whole struct StationSpec in SetCustomStation(), not just the rendering data. This will be needed for variational stationspecs (pasky).
darkvater
parents:
393
diff
changeset
|
108 |
}; |
ad3dcbfd2d48
(svn r591) -newgrf: Store whole struct StationSpec in SetCustomStation(), not just the rendering data. This will be needed for variational stationspecs (pasky).
darkvater
parents:
393
diff
changeset
|
109 |
|
400
d0608455bb77
(svn r592) -newgrf: Dynamically allocate global custom station IDs (pasky).
darkvater
parents:
399
diff
changeset
|
110 |
/* Here, @stid is local per-GRFFile station index. If spec->localidx is not yet |
d0608455bb77
(svn r592) -newgrf: Dynamically allocate global custom station IDs (pasky).
darkvater
parents:
399
diff
changeset
|
111 |
* set, it gets new dynamically allocated global index and spec->localidx is |
d0608455bb77
(svn r592) -newgrf: Dynamically allocate global custom station IDs (pasky).
darkvater
parents:
399
diff
changeset
|
112 |
* set to @stid, otherwise we take it as that we are replacing it and try to |
d0608455bb77
(svn r592) -newgrf: Dynamically allocate global custom station IDs (pasky).
darkvater
parents:
399
diff
changeset
|
113 |
* search for it first (that isn't much fast but we do it only very seldom). */ |
399
ad3dcbfd2d48
(svn r591) -newgrf: Store whole struct StationSpec in SetCustomStation(), not just the rendering data. This will be needed for variational stationspecs (pasky).
darkvater
parents:
393
diff
changeset
|
114 |
void SetCustomStation(byte stid, struct StationSpec *spec); |
400
d0608455bb77
(svn r592) -newgrf: Dynamically allocate global custom station IDs (pasky).
darkvater
parents:
399
diff
changeset
|
115 |
/* Here, @stid is global station index (in continous range 0..GetCustomStationsCount()) |
d0608455bb77
(svn r592) -newgrf: Dynamically allocate global custom station IDs (pasky).
darkvater
parents:
399
diff
changeset
|
116 |
* (lookup is therefore very fast as we do this very frequently). */ |
403
bfb365c74e80
(svn r600) -newgrf: Relocation offset for custom station sprites is now stored separately, making it possible to show different sprites in waypoint selection dialog (pasky).
darkvater
parents:
400
diff
changeset
|
117 |
struct StationSpec *GetCustomStation(uint32 classid, byte stid); |
bfb365c74e80
(svn r600) -newgrf: Relocation offset for custom station sprites is now stored separately, making it possible to show different sprites in waypoint selection dialog (pasky).
darkvater
parents:
400
diff
changeset
|
118 |
uint32 GetCustomStationRelocation(struct StationSpec *spec, byte ctype); |
389
2d394eeba5e5
(svn r581) -newgrf: Basic support for new stations - only waypoints supported now and only
celestar
parents:
384
diff
changeset
|
119 |
int GetCustomStationsCount(uint32 classid); |
2d394eeba5e5
(svn r581) -newgrf: Basic support for new stations - only waypoints supported now and only
celestar
parents:
384
diff
changeset
|
120 |
|
0 | 121 |
#endif /* STATION_H */ |