author | richk |
Tue, 17 Jun 2008 13:41:57 +0000 | |
branch | NewGRF_ports |
changeset 10995 | 311b38c7f9a7 |
parent 10346 | a1e9f8871c05 |
permissions | -rw-r--r-- |
6734
6e4db2fda167
(svn r10666) [NewGRF_ports] -Change: portFSM added to FSMportsSpec.
richk
parents:
6722
diff
changeset
|
1 |
/* $Id$ */ |
6722
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
2 |
|
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
3 |
/** @file newgrf_fsmports.h Header file for NewGRF Finite FSMPORTSe Machine Ports (airports, seaports, landports??) */ |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
4 |
|
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
5 |
#ifndef NEWGRF_FSMPORTS_H |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
6 |
#define NEWGRF_FSMPORTS_H |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
7 |
|
6872
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6853
diff
changeset
|
8 |
#include "core/enum_type.hpp" |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6853
diff
changeset
|
9 |
#include "tile_type.h" |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6853
diff
changeset
|
10 |
#include "map_type.h" |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6853
diff
changeset
|
11 |
#include "map_func.h" |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6853
diff
changeset
|
12 |
#include "tile_map.h" |
6722
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
13 |
#include "newgrf_cargo.h" |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
14 |
#include "sprite.h" |
6807
436fc766fc34
(svn r10881) [NewGRF_ports] -Feature: Adds irregular highlight to airport placement based on the FSMportLayout data. You can now see where the holes should be!
richk
parents:
6801
diff
changeset
|
15 |
#include "airport.h" |
10184
fcf5fb2548eb
(svn r12715) [NewGRF_ports] -Sync: with trunk r12351:12644.
richk
parents:
6874
diff
changeset
|
16 |
#include "station_type.h" |
fcf5fb2548eb
(svn r12715) [NewGRF_ports] -Sync: with trunk r12351:12644.
richk
parents:
6874
diff
changeset
|
17 |
#include "strings_func.h" |
6874
5d69ad7a3c98
(svn r12039) [NewGRF_ports] -Fix: Corrected GUI to revised format.
richk
parents:
6872
diff
changeset
|
18 |
#include "widgets/dropdown_type.h" |
6722
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
19 |
|
6793
1574da7d2297
(svn r10865) [NewGRF_ports] -Feature: Added oilrig. Reloads correctly for old games.
richk
parents:
6770
diff
changeset
|
20 |
enum FSMportClass { |
1574da7d2297
(svn r10865) [NewGRF_ports] -Feature: Added oilrig. Reloads correctly for old games.
richk
parents:
6770
diff
changeset
|
21 |
SYSTEM_HIDDEN_CLASS = 0x53595354 ///< SYST is a hidden class for things like oilrigs that need FSMs, but should not appear in picker lists |
1574da7d2297
(svn r10865) [NewGRF_ports] -Feature: Added oilrig. Reloads correctly for old games.
richk
parents:
6770
diff
changeset
|
22 |
}; |
1574da7d2297
(svn r10865) [NewGRF_ports] -Feature: Added oilrig. Reloads correctly for old games.
richk
parents:
6770
diff
changeset
|
23 |
|
6722
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
24 |
enum FSMportsClassID { |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
25 |
FSMPORTS_CLASS_BEGIN = 0, ///< the lowest valid value |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
26 |
FSMPORTS_CLASS_DFLT = 0, ///< Default FSMports class. |
6795
8a27be8048e3
(svn r10867) [NewGRF_ports] -Fix: SYST class needed to be loaded to the specific class 31 to avoid disturbing list sequences.
richk
parents:
6793
diff
changeset
|
27 |
FSMPORTS_CLASS_SYST = 31, ///< SYST hidden class |
6722
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
28 |
FSMPORTS_CLASS_MAX = 32, ///< Maximum number of classes. |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
29 |
}; |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
30 |
|
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
31 |
/** Define basic enum properties */ |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
32 |
template <> struct EnumPropsT<FSMportsClassID> : MakeEnumPropsT<FSMportsClassID, byte, FSMPORTS_CLASS_BEGIN, FSMPORTS_CLASS_MAX, FSMPORTS_CLASS_MAX> {}; |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
33 |
typedef TinyEnumT<FSMportsClassID> FSMportsClassIDByte; |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
34 |
|
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
35 |
/** Allow incrementing of FSMportsClassID variables */ |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
36 |
DECLARE_POSTFIX_INCREMENT(FSMportsClassID); |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
37 |
|
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
38 |
/* FSMports layout for given dimensions - it is a two-dimensional array |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
39 |
* where index is computed as (x * platforms) + platform. */ |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
40 |
typedef byte *FSMportsLayout; |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
41 |
|
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
42 |
struct FSMportsSpec { |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
43 |
const struct GRFFile *grffile; ///< ID of GRF file FSMports belongs to. |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
44 |
int localidx; ///< Index within GRF file of FSMports. |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
45 |
|
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
46 |
bool allocated; ///< Flag whether this FSMport has been added to a FSMports class list |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
47 |
|
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
48 |
FSMportsClassID sclass; ///< The class to which this spec belongs. |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
49 |
StringID name; ///< Name of this FSMport. |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
50 |
|
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
51 |
/** Number of tile layouts. |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
52 |
* A minimum of 8 is required is required for FSMportss. |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
53 |
* 0-1 = plain platform |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
54 |
* 2-3 = platform with building |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
55 |
* 4-5 = platform with roof, left side |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
56 |
* 6-7 = platform with roof, right side |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
57 |
*/ |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
58 |
uint tiles; |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
59 |
DrawTileSprites *renderdata; ///< Array of tile layouts. |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
60 |
bool copied_renderdata; |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
61 |
|
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
62 |
/** Cargo threshold for choosing between little and lots of cargo |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
63 |
* @note little/lots are equivalent to the moving/loading FSMPORTSes for vehicles |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
64 |
*/ |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
65 |
uint16 cargo_threshold; |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
66 |
|
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
67 |
uint32 cargo_triggers; ///< Bitmask of cargo types which cause trigger re-randomizing |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
68 |
|
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
69 |
byte callbackmask; ///< Bitmask of callbacks to use, @see newgrf_callbacks.h |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
70 |
|
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
71 |
byte flags; ///< Bitmask of flags, bit 0: use different sprite set; bit 1: divide cargo about by FSMports size |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
72 |
|
6745
f45a41940079
(svn r10783) [NewGRF_ports] -Feature: Added placing FSMport in any of up to 4 different orientations. GUI now has a preview image for each orientation - not interactive, just a screenshot stored.
richk
parents:
6743
diff
changeset
|
73 |
byte *size_x; |
f45a41940079
(svn r10783) [NewGRF_ports] -Feature: Added placing FSMport in any of up to 4 different orientations. GUI now has a preview image for each orientation - not interactive, just a screenshot stored.
richk
parents:
6743
diff
changeset
|
74 |
byte *size_y; |
6722
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
75 |
|
6745
f45a41940079
(svn r10783) [NewGRF_ports] -Feature: Added placing FSMport in any of up to 4 different orientations. GUI now has a preview image for each orientation - not interactive, just a screenshot stored.
richk
parents:
6743
diff
changeset
|
76 |
byte numlayouts; |
6801
a0b87c971f44
(svn r10873) [NewGRF_ports] -Fix: layouts and layout_masks had one level of pointer indirection too much.
rubidium
parents:
6795
diff
changeset
|
77 |
FSMportsLayout *layouts; |
6722
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
78 |
bool copied_layouts; |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
79 |
|
6801
a0b87c971f44
(svn r10873) [NewGRF_ports] -Fix: layouts and layout_masks had one level of pointer indirection too much.
rubidium
parents:
6795
diff
changeset
|
80 |
FSMportsLayout *layout_mask; |
6770
8400b517b905
(svn r10824) [NewGRF_ports] -Feature: Added basic code for seaplane airport support.
richk
parents:
6767
diff
changeset
|
81 |
|
6734
6e4db2fda167
(svn r10666) [NewGRF_ports] -Change: portFSM added to FSMportsSpec.
richk
parents:
6722
diff
changeset
|
82 |
AirportFTAClass *portFSM; |
6e4db2fda167
(svn r10666) [NewGRF_ports] -Change: portFSM added to FSMportsSpec.
richk
parents:
6722
diff
changeset
|
83 |
|
10280
ffc3a406abe7
(svn r12812) [NewGRF_ports] -Change: Added animation variables to fsmportspec and newgrf loader.
richk
parents:
10184
diff
changeset
|
84 |
uint8 anim_frames; |
ffc3a406abe7
(svn r12812) [NewGRF_ports] -Change: Added animation variables to fsmportspec and newgrf loader.
richk
parents:
10184
diff
changeset
|
85 |
uint8 anim_status; |
ffc3a406abe7
(svn r12812) [NewGRF_ports] -Change: Added animation variables to fsmportspec and newgrf loader.
richk
parents:
10184
diff
changeset
|
86 |
uint8 anim_speed; |
ffc3a406abe7
(svn r12812) [NewGRF_ports] -Change: Added animation variables to fsmportspec and newgrf loader.
richk
parents:
10184
diff
changeset
|
87 |
uint16 anim_triggers; |
ffc3a406abe7
(svn r12812) [NewGRF_ports] -Change: Added animation variables to fsmportspec and newgrf loader.
richk
parents:
10184
diff
changeset
|
88 |
|
6722
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
89 |
/** |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
90 |
* NUM_CARGO real cargo plus three pseudo cargo sprite groups. |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
91 |
* Used for obtaining the sprite offset of custom sprites, and for |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
92 |
* evaluating callbacks. |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
93 |
*/ |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
94 |
const struct SpriteGroup *spritegroup[NUM_CARGO + 3]; |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
95 |
}; |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
96 |
|
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
97 |
/** |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
98 |
* Struct containing information relating to FSMports classes. |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
99 |
*/ |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
100 |
struct FSMportsClass { |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
101 |
uint32 id; ///< ID of this class, e.g. 'DFLT', 'WAYP', etc. |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
102 |
StringID name; ///< Name of this class. |
6734
6e4db2fda167
(svn r10666) [NewGRF_ports] -Change: portFSM added to FSMportsSpec.
richk
parents:
6722
diff
changeset
|
103 |
uint FSMports; ///< Number of FSMports in this class. |
6722
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
104 |
FSMportsSpec **spec; ///< Array of FSMports specifications. |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
105 |
}; |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
106 |
|
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
107 |
void ResetFSMportsClasses(); |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
108 |
FSMportsClassID AllocateFSMportsClass(uint32 cls); |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
109 |
void SetFSMportsClassName(FSMportsClassID sclass, StringID name); |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
110 |
StringID GetFSMportsClassName(FSMportsClassID sclass); |
6874
5d69ad7a3c98
(svn r12039) [NewGRF_ports] -Fix: Corrected GUI to revised format.
richk
parents:
6872
diff
changeset
|
111 |
DropDownList *BuildFSMportsClassDropdown(); |
6722
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
112 |
|
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
113 |
uint GetNumFSMportsClasses(); |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
114 |
uint GetNumCustomFSMports(FSMportsClassID sclass); |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
115 |
|
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
116 |
void SetCustomFSMportsSpec(FSMportsSpec *FSMPORTSspec); |
6760
d7a806a9aa44
(svn r10802) [NewGRF_ports] -Feature: Added availability dates for airports, using callbacks. Gui modified to disable unavailable airports. If no airports available at all, airport placement disabled.
richk
parents:
6753
diff
changeset
|
117 |
FSMportsSpec *GetCustomFSMportsSpec(FSMportsClassID sclass, uint FSMports); |
6722
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
118 |
const FSMportsSpec *GetCustomFSMportsSpecByGrf(uint32 grfid, byte localidx); |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
119 |
|
6746
837a9ca5a2f0
(svn r10784) [NewGRF_ports] -Feature: Added rotation of FSMport movement.
richk
parents:
6745
diff
changeset
|
120 |
/* Rotate a position depending on the FSM_orientation */ |
837a9ca5a2f0
(svn r10784) [NewGRF_ports] -Feature: Added rotation of FSMport movement.
richk
parents:
6745
diff
changeset
|
121 |
TileIndexDiffC RotateFSMPosition(TileIndexDiffC position, byte size_x, byte size_y, byte FSM_orientation); |
6722
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
122 |
|
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
123 |
/* Get sprite offset for a given custom FSMports and FSMports structure (may be |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
124 |
* NULL - that means we are in a build dialog). The FSMports structure is used |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
125 |
* for variational sprite groups. */ |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
126 |
SpriteID GetCustomFSMportsRelocation(const FSMportsSpec *FSMPORTSspec, const Station *st, TileIndex tile); |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
127 |
SpriteID GetCustomFSMportsGroundRelocation(const FSMportsSpec *FSMPORTSspec, const Station *st, TileIndex tile); |
6743
cabfaa4a0295
(svn r10766) [NewGRF_ports] -Sync: with trunk r10651-10765
richk
parents:
6737
diff
changeset
|
128 |
uint16 GetFSMportsCallback(CallbackID callback, uint32 param1, uint32 param2, const FSMportsSpec *FSMPORTSspec, const Station *st, TileIndex tile); |
6722
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
129 |
|
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
130 |
/* Allocate a FSMportsSpec to a Station. This is called once per build operation. */ |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
131 |
int AllocateFSMportsSpecToStation(const FSMportsSpec *FSMPORTSspec, Station *st, bool exec); |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
132 |
|
10346
a1e9f8871c05
(svn r12887) [NewGRF_ports] -Fix: When upgrading an airport, remove the existing FSM first.
richk
parents:
10280
diff
changeset
|
133 |
/* Deallocate a FSMportsSpec from a Station. */ |
6722
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
134 |
void DeallocateSpecFromFSMports(Station* st, byte specindex); |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
135 |
|
10346
a1e9f8871c05
(svn r12887) [NewGRF_ports] -Fix: When upgrading an airport, remove the existing FSM first.
richk
parents:
10280
diff
changeset
|
136 |
/* Deallocate a FSMportsSpec from a Station, referenced by the spec itself. Use when specindex unknown. */ |
a1e9f8871c05
(svn r12887) [NewGRF_ports] -Fix: When upgrading an airport, remove the existing FSM first.
richk
parents:
10280
diff
changeset
|
137 |
void RemoveFSMSpecFromStationList(Station *st, const FSMportsSpec *fsmportspec); |
a1e9f8871c05
(svn r12887) [NewGRF_ports] -Fix: When upgrading an airport, remove the existing FSM first.
richk
parents:
10280
diff
changeset
|
138 |
|
6722
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
139 |
/* Set the spec index, and mark tile as an fsmport */ |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
140 |
static inline void SetCustomFSMportsSpecIndex(TileIndex t, byte specindex) |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
141 |
{ |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
142 |
assert(IsTileType(t, MP_STATION)); |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
143 |
_m[t].m4 = specindex; |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
144 |
_m[t].m6 |= 0x80; // set top bit of m6 to indicate it is an fsmport |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
145 |
} |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
146 |
|
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
147 |
/* Check if tile has a specindex and is an fsmport */ |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
148 |
static inline bool IsCustomFSMportsSpecIndex(TileIndex t) |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
149 |
{ |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
150 |
return ((_m[t].m4 != 0) && ((_m[t].m6 & 0x80) == 0x80)); |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
151 |
} |
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
152 |
|
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
153 |
/* Draw representation of a FSMports tile for GUI purposes. */ |
6745
f45a41940079
(svn r10783) [NewGRF_ports] -Feature: Added placing FSMport in any of up to 4 different orientations. GUI now has a preview image for each orientation - not interactive, just a screenshot stored.
richk
parents:
6743
diff
changeset
|
154 |
bool DrawFSMportsTile(int x, int y, byte tile, FSMportsClassID sclass, uint FSMports); |
6722
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
155 |
|
72f280229ee1
(svn r10586) [NewGRF_ports] -Feature: Load an airport via a newgrf file. Currently, only graphics support provided.
richk
parents:
diff
changeset
|
156 |
#endif /* NEWGRF_FSMPORTS_H */ |