9 #endif |
9 #endif |
10 |
10 |
11 #include "hal.h" |
11 #include "hal.h" |
12 #include "helpers.hpp" |
12 #include "helpers.hpp" |
13 |
13 |
14 typedef struct Oblong { |
14 struct Oblong { |
15 int x, y; |
15 int x, y; |
16 int width, height; |
16 int width, height; |
17 } Oblong; |
17 }; |
18 |
18 |
19 typedef struct BoundingRect { |
19 struct BoundingRect { |
20 int width; |
20 int width; |
21 int height; |
21 int height; |
22 } BoundingRect; |
22 }; |
23 |
23 |
24 typedef struct Pair { |
24 struct Pair { |
25 int a; |
25 int a; |
26 int b; |
26 int b; |
27 } Pair; |
27 }; |
28 |
28 |
29 #include "map.h" |
29 #include "map.h" |
30 #include "slope.h" |
30 #include "slope.h" |
31 |
31 |
32 // Forward declarations of structs. |
32 // Forward declarations of structs. |
33 typedef struct Vehicle Vehicle; |
33 struct Vehicle; |
34 typedef struct Depot Depot; |
34 struct Depot; |
35 typedef struct Waypoint Waypoint; |
35 struct Waypoint; |
36 typedef struct Window Window; |
36 struct Window; |
37 typedef struct Station Station; |
37 struct Station; |
38 typedef struct ViewPort ViewPort; |
38 struct ViewPort; |
39 typedef struct Town Town; |
39 struct Town; |
40 typedef struct NewsItem NewsItem; |
40 struct NewsItem; |
41 typedef struct Industry Industry; |
41 struct Industry; |
42 typedef struct DrawPixelInfo DrawPixelInfo; |
42 struct DrawPixelInfo; |
43 typedef byte VehicleOrderID; ///< The index of an order within its current vehicle (not pool related) |
43 typedef byte VehicleOrderID; ///< The index of an order within its current vehicle (not pool related) |
44 typedef byte CargoID; |
44 typedef byte CargoID; |
45 typedef byte LandscapeID; |
45 typedef byte LandscapeID; |
46 typedef uint32 SpriteID; ///< The number of a sprite, without mapping bits and colortables |
46 typedef uint32 SpriteID; ///< The number of a sprite, without mapping bits and colortables |
47 typedef struct PalSpriteID { |
47 struct PalSpriteID { |
48 SpriteID sprite; |
48 SpriteID sprite; |
49 SpriteID pal; |
49 SpriteID pal; |
50 } PalSpriteID; |
50 }; |
51 typedef uint16 EngineID; |
51 typedef uint16 EngineID; |
52 typedef uint16 UnitID; |
52 typedef uint16 UnitID; |
53 typedef uint16 StringID; |
53 typedef uint16 StringID; |
54 typedef EngineID *EngineList; ///< engine list type placeholder acceptable for C code (see helpers.cpp) |
54 typedef EngineID *EngineList; ///< engine list type placeholder acceptable for C code (see helpers.cpp) |
55 |
55 |
138 template <> struct EnumPropsT<Owner> : MakeEnumPropsT<Owner, byte, OWNER_BEGIN, OWNER_END, INVALID_OWNER> {}; |
138 template <> struct EnumPropsT<Owner> : MakeEnumPropsT<Owner, byte, OWNER_BEGIN, OWNER_END, INVALID_OWNER> {}; |
139 typedef TinyEnumT<Owner> OwnerByte; |
139 typedef TinyEnumT<Owner> OwnerByte; |
140 typedef OwnerByte PlayerByte; |
140 typedef OwnerByte PlayerByte; |
141 |
141 |
142 |
142 |
143 typedef enum TransportTypes { |
143 enum TransportType { |
144 /* These constants are for now linked to the representation of bridges |
144 /* These constants are for now linked to the representation of bridges |
145 * and tunnels, so they can be used by GetTileTrackStatus_TunnelBridge. |
145 * and tunnels, so they can be used by GetTileTrackStatus_TunnelBridge. |
146 * In an ideal world, these constants would be used everywhere when |
146 * In an ideal world, these constants would be used everywhere when |
147 * accessing tunnels and bridges. For now, you should just not change |
147 * accessing tunnels and bridges. For now, you should just not change |
148 * the values for road and rail. |
148 * the values for road and rail. |
151 TRANSPORT_RAIL = 0, |
151 TRANSPORT_RAIL = 0, |
152 TRANSPORT_ROAD = 1, |
152 TRANSPORT_ROAD = 1, |
153 TRANSPORT_WATER, // = 2 |
153 TRANSPORT_WATER, // = 2 |
154 TRANSPORT_END, |
154 TRANSPORT_END, |
155 INVALID_TRANSPORT = 0xff, |
155 INVALID_TRANSPORT = 0xff, |
156 } TransportType; |
156 }; |
157 |
157 |
158 /** Define basic enum properties */ |
158 /** Define basic enum properties */ |
159 template <> struct EnumPropsT<TransportType> : MakeEnumPropsT<TransportType, byte, TRANSPORT_BEGIN, TRANSPORT_END, INVALID_TRANSPORT> {}; |
159 template <> struct EnumPropsT<TransportType> : MakeEnumPropsT<TransportType, byte, TRANSPORT_BEGIN, TRANSPORT_END, INVALID_TRANSPORT> {}; |
160 typedef TinyEnumT<TransportType> TransportTypeByte; |
160 typedef TinyEnumT<TransportType> TransportTypeByte; |
161 |
161 |
162 |
162 |
163 typedef struct TileInfo { |
163 struct TileInfo { |
164 uint x; |
164 uint x; |
165 uint y; |
165 uint y; |
166 Slope tileh; |
166 Slope tileh; |
167 TileIndex tile; |
167 TileIndex tile; |
168 uint z; |
168 uint z; |
169 } TileInfo; |
169 }; |
170 |
170 |
171 |
171 |
172 /* Display Options */ |
172 /* Display Options */ |
173 enum { |
173 enum { |
174 DO_SHOW_TOWN_NAMES = 1 << 0, |
174 DO_SHOW_TOWN_NAMES = 1 << 0, |
241 int32 running_rail[3]; |
241 int32 running_rail[3]; |
242 int32 aircraft_running; |
242 int32 aircraft_running; |
243 int32 roadveh_running; |
243 int32 roadveh_running; |
244 int32 ship_running; |
244 int32 ship_running; |
245 int32 build_industry; |
245 int32 build_industry; |
246 } Prices; |
246 }; |
247 |
247 |
248 #define GAME_DIFFICULTY_NUM 18 |
248 #define GAME_DIFFICULTY_NUM 18 |
249 |
249 |
250 typedef struct GameDifficulty { |
250 struct GameDifficulty { |
251 int max_no_competitors; |
251 int max_no_competitors; |
252 int competitor_start_time; |
252 int competitor_start_time; |
253 int number_towns; |
253 int number_towns; |
254 int number_industries; |
254 int number_industries; |
255 int max_loan; |
255 int max_loan; |
315 CT_INVALID = 0xFF |
315 CT_INVALID = 0xFF |
316 }; |
316 }; |
317 |
317 |
318 typedef uint AcceptedCargo[NUM_CARGO]; |
318 typedef uint AcceptedCargo[NUM_CARGO]; |
319 |
319 |
320 typedef struct TileDesc { |
320 struct TileDesc { |
321 StringID str; |
321 StringID str; |
322 Owner owner; |
322 Owner owner; |
323 Date build_date; |
323 Date build_date; |
324 uint32 dparam[2]; |
324 uint32 dparam[2]; |
325 } TileDesc; |
325 }; |
326 |
326 |
327 typedef struct { |
327 struct ViewportSign { |
328 int32 left; |
328 int32 left; |
329 int32 top; |
329 int32 top; |
330 byte width_1, width_2; |
330 byte width_1, width_2; |
331 } ViewportSign; |
331 }; |
332 |
332 |
333 |
333 |
334 typedef void DrawTileProc(TileInfo *ti); |
334 typedef void DrawTileProc(TileInfo *ti); |
335 typedef uint GetSlopeZProc(TileIndex tile, uint x, uint y); |
335 typedef uint GetSlopeZProc(TileIndex tile, uint x, uint y); |
336 typedef int32 ClearTileProc(TileIndex tile, byte flags); |
336 typedef int32 ClearTileProc(TileIndex tile, byte flags); |
363 typedef void ChangeTileOwnerProc(TileIndex tile, PlayerID old_player, PlayerID new_player); |
363 typedef void ChangeTileOwnerProc(TileIndex tile, PlayerID old_player, PlayerID new_player); |
364 /** @see VehicleEnterTileStatus to see what the return values mean */ |
364 /** @see VehicleEnterTileStatus to see what the return values mean */ |
365 typedef uint32 VehicleEnterTileProc(Vehicle *v, TileIndex tile, int x, int y); |
365 typedef uint32 VehicleEnterTileProc(Vehicle *v, TileIndex tile, int x, int y); |
366 typedef Slope GetSlopeTilehProc(TileIndex, Slope tileh); |
366 typedef Slope GetSlopeTilehProc(TileIndex, Slope tileh); |
367 |
367 |
368 typedef struct { |
368 struct TileTypeProcs { |
369 DrawTileProc *draw_tile_proc; |
369 DrawTileProc *draw_tile_proc; |
370 GetSlopeZProc *get_slope_z_proc; |
370 GetSlopeZProc *get_slope_z_proc; |
371 ClearTileProc *clear_tile_proc; |
371 ClearTileProc *clear_tile_proc; |
372 GetAcceptedCargoProc *get_accepted_cargo_proc; |
372 GetAcceptedCargoProc *get_accepted_cargo_proc; |
373 GetTileDescProc *get_tile_desc_proc; |
373 GetTileDescProc *get_tile_desc_proc; |
377 TileLoopProc *tile_loop_proc; |
377 TileLoopProc *tile_loop_proc; |
378 ChangeTileOwnerProc *change_tile_owner_proc; |
378 ChangeTileOwnerProc *change_tile_owner_proc; |
379 GetProducedCargoProc *get_produced_cargo_proc; |
379 GetProducedCargoProc *get_produced_cargo_proc; |
380 VehicleEnterTileProc *vehicle_enter_tile_proc; |
380 VehicleEnterTileProc *vehicle_enter_tile_proc; |
381 GetSlopeTilehProc *get_slope_tileh_proc; |
381 GetSlopeTilehProc *get_slope_tileh_proc; |
382 } TileTypeProcs; |
382 }; |
383 |
383 |
384 |
384 |
385 enum WindowClass { |
385 enum WindowClass { |
386 WC_NONE, |
386 WC_NONE, |
387 WC_MAIN_WINDOW = WC_NONE, |
387 WC_MAIN_WINDOW = WC_NONE, |
573 VARDEF byte _no_scroll; |
573 VARDEF byte _no_scroll; |
574 |
574 |
575 /** To have a concurrently running thread interface with the main program, use |
575 /** To have a concurrently running thread interface with the main program, use |
576 * the OTTD_SendThreadMessage() function. Actions to perform upon the message are handled |
576 * the OTTD_SendThreadMessage() function. Actions to perform upon the message are handled |
577 * in the ProcessSentMessage() function */ |
577 * in the ProcessSentMessage() function */ |
578 typedef enum ThreadMsgs { |
578 enum ThreadMsg { |
579 MSG_OTTD_NO_MESSAGE, |
579 MSG_OTTD_NO_MESSAGE, |
580 MSG_OTTD_SAVETHREAD_DONE, |
580 MSG_OTTD_SAVETHREAD_DONE, |
581 MSG_OTTD_SAVETHREAD_ERROR, |
581 MSG_OTTD_SAVETHREAD_ERROR, |
582 } ThreadMsg; |
582 }; |
583 |
583 |
584 void OTTD_SendThreadMessage(ThreadMsg msg); |
584 void OTTD_SendThreadMessage(ThreadMsg msg); |
585 |
585 |
586 #endif /* OPENTTD_H */ |
586 #endif /* OPENTTD_H */ |