author | truelight |
Thu, 24 Mar 2005 14:43:40 +0000 | |
changeset 1540 | 6eef12dab5bf |
parent 1397 | fa8539dcab46 |
child 1575 | 1f403d3c354f |
permissions | -rw-r--r-- |
0 | 1 |
#ifndef TTD_H |
2 |
#define TTD_H |
|
3 |
||
4 |
#ifndef VARDEF |
|
5 |
#define VARDEF extern |
|
6 |
#endif |
|
7 |
||
8 |
// use this on non static functions |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
168
diff
changeset
|
9 |
#define PUBLIC |
0 | 10 |
|
11 |
typedef struct Rect { |
|
12 |
int left,top,right,bottom; |
|
13 |
} Rect; |
|
14 |
||
15 |
typedef struct SmallPoint { |
|
16 |
int16 x,y; |
|
17 |
} SmallPoint; |
|
18 |
||
19 |
typedef struct Point { |
|
20 |
int x,y; |
|
21 |
} Point; |
|
22 |
||
23 |
typedef struct Pair { |
|
24 |
int a; |
|
25 |
int b; |
|
26 |
} Pair; |
|
27 |
||
28 |
typedef struct YearMonthDay { |
|
29 |
int year, month, day; |
|
30 |
} YearMonthDay; |
|
31 |
||
164
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
159
diff
changeset
|
32 |
/* --- 1 Day is 74 ticks --- |
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
159
diff
changeset
|
33 |
* The game's internal structure is dictated by ticks. The date counter (date_fract) is an integer of |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
168
diff
changeset
|
34 |
* uint16 type, so it can have a max value of 65536. Every tick this variable (date_fract) is |
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
168
diff
changeset
|
35 |
* increased by 885. When it overflows, the new day loop is called. |
164
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
159
diff
changeset
|
36 |
* * this that means 1 day is : 65536 / 885 = 74 ticks |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
168
diff
changeset
|
37 |
* * 1 tick is approximately 27ms. |
164
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
159
diff
changeset
|
38 |
* * 1 day is thus about 2 seconds (74*27 = 1998) on a machine that can run OpenTTD normally |
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
159
diff
changeset
|
39 |
*/ |
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
159
diff
changeset
|
40 |
#define DAY_TICKS 74 |
970
24abd02b1092
(svn r1465) -Fix: [1099101] starting year patch goes out of range. Clamped year between 1920-2090 as wel as adding defines for it.
darkvater
parents:
948
diff
changeset
|
41 |
#define MAX_YEAR_BEGIN_REAL 1920 |
24abd02b1092
(svn r1465) -Fix: [1099101] starting year patch goes out of range. Clamped year between 1920-2090 as wel as adding defines for it.
darkvater
parents:
948
diff
changeset
|
42 |
#define MAX_YEAR_END_REAL 2090 |
24abd02b1092
(svn r1465) -Fix: [1099101] starting year patch goes out of range. Clamped year between 1920-2090 as wel as adding defines for it.
darkvater
parents:
948
diff
changeset
|
43 |
#define MAX_YEAR_END 170 |
164
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
159
diff
changeset
|
44 |
|
0 | 45 |
#include "macros.h" |
46 |
||
47 |
// Forward declarations of structs. |
|
48 |
typedef struct Vehicle Vehicle; |
|
49 |
typedef struct Depot Depot; |
|
395
788a9bba0889
(svn r587) -newgrf: Rename all /Checkpoint/i tokens to 'Waypoint's. The name actually makes some sense and is also compatible with TTDPatch (pasky).
darkvater
parents:
265
diff
changeset
|
50 |
typedef struct Waypoint Waypoint; |
0 | 51 |
typedef struct Window Window; |
52 |
typedef struct Station Station; |
|
53 |
typedef struct ViewPort ViewPort; |
|
54 |
typedef struct Town Town; |
|
55 |
typedef struct NewsItem NewsItem; |
|
56 |
typedef struct Industry Industry; |
|
57 |
typedef struct DrawPixelInfo DrawPixelInfo; |
|
58 |
typedef uint16 VehicleID; |
|
59 |
typedef uint16 StringID; |
|
60 |
typedef uint16 SpriteID; |
|
61 |
typedef uint32 PalSpriteID; |
|
62 |
||
63 |
typedef uint32 WindowNumber; |
|
64 |
typedef byte WindowClass; |
|
65 |
||
66 |
||
67 |
enum GameModes { |
|
68 |
GM_MENU, |
|
69 |
GM_NORMAL, |
|
70 |
GM_EDITOR |
|
71 |
}; |
|
72 |
||
73 |
enum SwitchModes { |
|
74 |
SM_NONE = 0, |
|
75 |
SM_NEWGAME = 1, |
|
76 |
SM_EDITOR = 2, |
|
77 |
SM_LOAD = 3, |
|
78 |
SM_MENU = 4, |
|
79 |
SM_SAVE = 5, |
|
80 |
SM_GENRANDLAND = 6, |
|
81 |
SM_LOAD_SCENARIO = 9, |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
513
diff
changeset
|
82 |
SM_START_SCENARIO = 10, |
0 | 83 |
}; |
84 |
||
159
139cf78bfb28
(svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents:
152
diff
changeset
|
85 |
typedef enum TransportTypes { |
139cf78bfb28
(svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents:
152
diff
changeset
|
86 |
/* These constants are for now linked to the representation of bridges |
139cf78bfb28
(svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents:
152
diff
changeset
|
87 |
* and tunnels, so they can be used by GetTileTrackStatus_TunnelBridge |
139cf78bfb28
(svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents:
152
diff
changeset
|
88 |
* to compare against the map5 array. In an ideal world, these |
139cf78bfb28
(svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents:
152
diff
changeset
|
89 |
* constants would be used everywhere when accessing tunnels and |
139cf78bfb28
(svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents:
152
diff
changeset
|
90 |
* bridges. For now, you should just not change the values for road |
139cf78bfb28
(svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents:
152
diff
changeset
|
91 |
* and rail. |
139cf78bfb28
(svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents:
152
diff
changeset
|
92 |
*/ |
241
e6e62a5e7f52
(svn r242) -Fix: Pathfinding bug for road vehicles introduced in r160 fixed (blathijs)
darkvater
parents:
240
diff
changeset
|
93 |
TRANSPORT_RAIL = 0, |
159
139cf78bfb28
(svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents:
152
diff
changeset
|
94 |
TRANSPORT_ROAD = 1, |
241
e6e62a5e7f52
(svn r242) -Fix: Pathfinding bug for road vehicles introduced in r160 fixed (blathijs)
darkvater
parents:
240
diff
changeset
|
95 |
TRANSPORT_WATER, // = 2 |
e6e62a5e7f52
(svn r242) -Fix: Pathfinding bug for road vehicles introduced in r160 fixed (blathijs)
darkvater
parents:
240
diff
changeset
|
96 |
TRANSPORT_MAX // = 3 |
159
139cf78bfb28
(svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents:
152
diff
changeset
|
97 |
} TransportType; |
139cf78bfb28
(svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents:
152
diff
changeset
|
98 |
|
0 | 99 |
typedef struct TileInfo { |
100 |
uint x; |
|
101 |
uint y; |
|
102 |
uint tileh; |
|
103 |
uint type; |
|
104 |
uint map5; |
|
105 |
uint tile; |
|
106 |
uint z; |
|
107 |
} TileInfo; |
|
108 |
||
109 |
enum { |
|
110 |
NG_EDGE = 1, |
|
111 |
}; |
|
112 |
||
113 |
/* Display Options */ |
|
114 |
enum { |
|
115 |
DO_SHOW_TOWN_NAMES = 1, |
|
116 |
DO_SHOW_STATION_NAMES = 2, |
|
117 |
DO_SHOW_SIGNS = 4, |
|
118 |
DO_FULL_ANIMATION = 8, |
|
119 |
DO_TRANS_BUILDINGS = 0x10, |
|
120 |
DO_FULL_DETAIL = 0x20, |
|
395
788a9bba0889
(svn r587) -newgrf: Rename all /Checkpoint/i tokens to 'Waypoint's. The name actually makes some sense and is also compatible with TTDPatch (pasky).
darkvater
parents:
265
diff
changeset
|
121 |
DO_WAYPOINTS = 0x40, |
0 | 122 |
}; |
123 |
||
124 |
/* Landscape types */ |
|
125 |
enum { |
|
126 |
LT_NORMAL = 0, |
|
127 |
LT_HILLY = 1, |
|
128 |
LT_DESERT = 2, |
|
129 |
LT_CANDY = 3, |
|
130 |
||
131 |
NUM_LANDSCAPE = 4, |
|
132 |
}; |
|
133 |
||
134 |
enum { |
|
135 |
NUM_PRICES = 49, |
|
136 |
}; |
|
137 |
||
138 |
typedef struct Prices { |
|
139 |
int32 station_value; |
|
140 |
int32 build_rail; |
|
141 |
int32 build_road; |
|
142 |
int32 build_signals; |
|
143 |
int32 build_bridge; |
|
144 |
int32 build_train_depot; |
|
145 |
int32 build_road_depot; |
|
146 |
int32 build_ship_depot; |
|
147 |
int32 build_tunnel; |
|
148 |
int32 train_station_track; |
|
149 |
int32 train_station_length; |
|
150 |
int32 build_airport; |
|
151 |
int32 build_bus_station; |
|
152 |
int32 build_truck_station; |
|
153 |
int32 build_dock; |
|
154 |
int32 build_railvehicle; |
|
155 |
int32 build_railwagon; |
|
156 |
int32 aircraft_base; |
|
157 |
int32 roadveh_base; |
|
158 |
int32 ship_base; |
|
159 |
int32 build_trees; |
|
160 |
int32 terraform; |
|
161 |
int32 clear_1; |
|
162 |
int32 purchase_land; |
|
163 |
int32 clear_2; |
|
164 |
int32 clear_3; |
|
165 |
int32 remove_trees; |
|
166 |
int32 remove_rail; |
|
167 |
int32 remove_signals; |
|
168 |
int32 clear_bridge; |
|
169 |
int32 remove_train_depot; |
|
170 |
int32 remove_road_depot; |
|
171 |
int32 remove_ship_depot; |
|
172 |
int32 clear_tunnel; |
|
173 |
int32 clear_water; |
|
174 |
int32 remove_rail_station; |
|
175 |
int32 remove_airport; |
|
176 |
int32 remove_bus_station; |
|
177 |
int32 remove_truck_station; |
|
178 |
int32 remove_dock; |
|
179 |
int32 remove_house; |
|
180 |
int32 remove_road; |
|
181 |
int32 running_rail[3]; |
|
182 |
int32 aircraft_running; |
|
183 |
int32 roadveh_running; |
|
184 |
int32 ship_running; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
168
diff
changeset
|
185 |
int32 build_industry; |
0 | 186 |
} Prices; |
187 |
||
188 |
#define GAME_DIFFICULTY_NUM 18 |
|
189 |
||
190 |
typedef struct GameDifficulty { |
|
191 |
int max_no_competitors; |
|
192 |
int competitor_start_time; |
|
193 |
int number_towns; |
|
194 |
int number_industries; |
|
195 |
int max_loan; |
|
196 |
int initial_interest; |
|
197 |
int vehicle_costs; |
|
198 |
int competitor_speed; |
|
199 |
int competitor_intelligence; |
|
200 |
int vehicle_breakdowns; |
|
201 |
int subsidy_multiplier; |
|
202 |
int construction_cost; |
|
203 |
int terrain_type; |
|
204 |
int quantity_sea_lakes; |
|
205 |
int economy; |
|
206 |
int line_reverse_mode; |
|
207 |
int disasters; |
|
208 |
int town_council_tolerance; // minimum required town ratings to be allowed to demolish stuff |
|
209 |
} GameDifficulty; |
|
210 |
||
473
77f0ef57e7cf
(svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents:
395
diff
changeset
|
211 |
enum { |
77f0ef57e7cf
(svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents:
395
diff
changeset
|
212 |
// Temperate |
77f0ef57e7cf
(svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents:
395
diff
changeset
|
213 |
CT_PASSENGERS = 0, |
77f0ef57e7cf
(svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents:
395
diff
changeset
|
214 |
CT_COAL = 1, |
77f0ef57e7cf
(svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents:
395
diff
changeset
|
215 |
CT_MAIL = 2, |
77f0ef57e7cf
(svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents:
395
diff
changeset
|
216 |
CT_OIL = 3, |
77f0ef57e7cf
(svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents:
395
diff
changeset
|
217 |
CT_LIVESTOCK = 4, |
77f0ef57e7cf
(svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents:
395
diff
changeset
|
218 |
CT_GOODS = 5, |
77f0ef57e7cf
(svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents:
395
diff
changeset
|
219 |
CT_GRAIN = 6, |
77f0ef57e7cf
(svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents:
395
diff
changeset
|
220 |
CT_WOOD = 7, |
77f0ef57e7cf
(svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents:
395
diff
changeset
|
221 |
CT_IRON_ORE = 8, |
77f0ef57e7cf
(svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents:
395
diff
changeset
|
222 |
CT_STEEL = 9, |
77f0ef57e7cf
(svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents:
395
diff
changeset
|
223 |
CT_VALUABLES = 10, |
77f0ef57e7cf
(svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents:
395
diff
changeset
|
224 |
CT_FOOD = 11, |
77f0ef57e7cf
(svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents:
395
diff
changeset
|
225 |
|
77f0ef57e7cf
(svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents:
395
diff
changeset
|
226 |
// Arctic |
924
6fbd4419db2a
(svn r1412) -Feature/Fix: Aircraft refit options have been restricted to "sane"
celestar
parents:
849
diff
changeset
|
227 |
CT_WHEAT = 6, |
473
77f0ef57e7cf
(svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents:
395
diff
changeset
|
228 |
CT_HILLY_UNUSED = 8, |
77f0ef57e7cf
(svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents:
395
diff
changeset
|
229 |
CT_PAPER = 9, |
924
6fbd4419db2a
(svn r1412) -Feature/Fix: Aircraft refit options have been restricted to "sane"
celestar
parents:
849
diff
changeset
|
230 |
CT_GOLD = 10, |
473
77f0ef57e7cf
(svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents:
395
diff
changeset
|
231 |
|
77f0ef57e7cf
(svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents:
395
diff
changeset
|
232 |
// Tropic |
77f0ef57e7cf
(svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents:
395
diff
changeset
|
233 |
CT_RUBBER = 1, |
77f0ef57e7cf
(svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents:
395
diff
changeset
|
234 |
CT_FRUIT = 4, |
924
6fbd4419db2a
(svn r1412) -Feature/Fix: Aircraft refit options have been restricted to "sane"
celestar
parents:
849
diff
changeset
|
235 |
CT_MAIZE = 6, |
473
77f0ef57e7cf
(svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents:
395
diff
changeset
|
236 |
CT_COPPER_ORE = 8, |
77f0ef57e7cf
(svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents:
395
diff
changeset
|
237 |
CT_WATER = 9, |
924
6fbd4419db2a
(svn r1412) -Feature/Fix: Aircraft refit options have been restricted to "sane"
celestar
parents:
849
diff
changeset
|
238 |
CT_DIAMONDS = 10, |
473
77f0ef57e7cf
(svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents:
395
diff
changeset
|
239 |
|
77f0ef57e7cf
(svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents:
395
diff
changeset
|
240 |
// Toyland |
77f0ef57e7cf
(svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents:
395
diff
changeset
|
241 |
CT_SUGAR = 1, |
77f0ef57e7cf
(svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents:
395
diff
changeset
|
242 |
CT_TOYS = 3, |
77f0ef57e7cf
(svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents:
395
diff
changeset
|
243 |
CT_BATTERIES = 4, |
77f0ef57e7cf
(svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents:
395
diff
changeset
|
244 |
CT_CANDY = 5, |
77f0ef57e7cf
(svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents:
395
diff
changeset
|
245 |
CT_TOFFEE = 6, |
77f0ef57e7cf
(svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents:
395
diff
changeset
|
246 |
CT_COLA = 7, |
77f0ef57e7cf
(svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents:
395
diff
changeset
|
247 |
CT_COTTON_CANDY = 8, |
77f0ef57e7cf
(svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents:
395
diff
changeset
|
248 |
CT_BUBBLES = 9, |
77f0ef57e7cf
(svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents:
395
diff
changeset
|
249 |
CT_PLASTIC = 10, |
77f0ef57e7cf
(svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents:
395
diff
changeset
|
250 |
CT_FIZZY_DRINKS = 11, |
77f0ef57e7cf
(svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents:
395
diff
changeset
|
251 |
|
77f0ef57e7cf
(svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents:
395
diff
changeset
|
252 |
NUM_CARGO = 12, |
1004 | 253 |
|
254 |
CT_INVALID = 0xFF |
|
473
77f0ef57e7cf
(svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents:
395
diff
changeset
|
255 |
}; |
77f0ef57e7cf
(svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents:
395
diff
changeset
|
256 |
|
77f0ef57e7cf
(svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents:
395
diff
changeset
|
257 |
typedef uint AcceptedCargo[NUM_CARGO]; |
0 | 258 |
|
259 |
typedef struct TileDesc { |
|
260 |
StringID str; |
|
261 |
byte owner; |
|
71
1b8e15a10515
(svn r72) -Add: build_date of station (viewable with Query tool)
truelight
parents:
39
diff
changeset
|
262 |
uint16 build_date; |
0 | 263 |
uint32 dparam[2]; |
264 |
} TileDesc; |
|
265 |
||
266 |
typedef struct { |
|
849
c3407041774f
(svn r1330) Increase size of some vars from int16 to int32 to guard against future overflows
tron
parents:
842
diff
changeset
|
267 |
int32 left; |
c3407041774f
(svn r1330) Increase size of some vars from int16 to int32 to guard against future overflows
tron
parents:
842
diff
changeset
|
268 |
int32 top; |
0 | 269 |
byte width_1, width_2; |
270 |
} ViewportSign; |
|
271 |
||
272 |
typedef int32 CommandProc(int x, int y, uint32 flags, uint32 p1, uint32 p2); |
|
273 |
||
274 |
typedef void DrawTileProc(TileInfo *ti); |
|
275 |
typedef uint GetSlopeZProc(TileInfo *ti); |
|
276 |
typedef int32 ClearTileProc(uint tile, byte flags); |
|
473
77f0ef57e7cf
(svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents:
395
diff
changeset
|
277 |
typedef void GetAcceptedCargoProc(uint tile, AcceptedCargo res); |
0 | 278 |
typedef void GetTileDescProc(uint tile, TileDesc *td); |
159
139cf78bfb28
(svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents:
152
diff
changeset
|
279 |
/* GetTileTrackStatusProcs return a value that contains the possible tracks |
139cf78bfb28
(svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents:
152
diff
changeset
|
280 |
* that can be taken on a given tile by a given transport. The return value is |
139cf78bfb28
(svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents:
152
diff
changeset
|
281 |
* composed as follows: 0xaabbccdd. ccdd and aabb are bitmasks of trackdirs, |
139cf78bfb28
(svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents:
152
diff
changeset
|
282 |
* where bit n corresponds to trackdir n. ccdd are the trackdirs that are |
139cf78bfb28
(svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents:
152
diff
changeset
|
283 |
* present in the tile (1==present, 0==not present), aabb is the signal |
139cf78bfb28
(svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents:
152
diff
changeset
|
284 |
* status, if applicable (0==green/no signal, 1==red, note that this is |
139cf78bfb28
(svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents:
152
diff
changeset
|
285 |
* reversed from map3/2[tile] for railway signals). |
139cf78bfb28
(svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents:
152
diff
changeset
|
286 |
* |
139cf78bfb28
(svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents:
152
diff
changeset
|
287 |
* The result (let's call it ts) is often used as follows: |
139cf78bfb28
(svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents:
152
diff
changeset
|
288 |
* tracks = (byte)(ts | ts >>8) |
139cf78bfb28
(svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents:
152
diff
changeset
|
289 |
* This effectively converts the present part of the result (ccdd) to a |
139cf78bfb28
(svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents:
152
diff
changeset
|
290 |
* track bitmask, which disregards directions. Normally, this is the same as just |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
168
diff
changeset
|
291 |
* doing (byte)ts I think, although I am not really sure |
159
139cf78bfb28
(svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents:
152
diff
changeset
|
292 |
* |
139cf78bfb28
(svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents:
152
diff
changeset
|
293 |
* A trackdir is combination of a track and a dir, where the lower three bits |
139cf78bfb28
(svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents:
152
diff
changeset
|
294 |
* are a track, the fourth bit is the direction. these give 12 (or 14) |
139cf78bfb28
(svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents:
152
diff
changeset
|
295 |
* possible options: 0-5 and 8-13, so we need 14 bits for a trackdir bitmask |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
168
diff
changeset
|
296 |
* above. |
159
139cf78bfb28
(svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents:
152
diff
changeset
|
297 |
*/ |
139cf78bfb28
(svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents:
152
diff
changeset
|
298 |
typedef uint32 GetTileTrackStatusProc(uint tile, TransportType mode); |
0 | 299 |
typedef void GetProducedCargoProc(uint tile, byte *b); |
300 |
typedef void ClickTileProc(uint tile); |
|
301 |
typedef void AnimateTileProc(uint tile); |
|
302 |
typedef void TileLoopProc(uint tile); |
|
303 |
typedef void ChangeTileOwnerProc(uint tile, byte old_player, byte new_player); |
|
22 | 304 |
/* Return value has bit 0x2 set, when the vehicle enters a station. Then, |
305 |
* result << 8 contains the id of the station entered. If the return value has |
|
306 |
* bit 0x8 set, the vehicle could not and did not enter the tile. Are there |
|
307 |
* other bits that can be set? */ |
|
0 | 308 |
typedef uint32 VehicleEnterTileProc(Vehicle *v, uint tile, int x, int y); |
309 |
typedef void VehicleLeaveTileProc(Vehicle *v, uint tile, int x, int y); |
|
39 | 310 |
typedef uint GetSlopeTilehProc(TileInfo *ti); |
0 | 311 |
|
312 |
typedef struct { |
|
313 |
DrawTileProc *draw_tile_proc; |
|
314 |
GetSlopeZProc *get_slope_z_proc; |
|
315 |
ClearTileProc *clear_tile_proc; |
|
316 |
GetAcceptedCargoProc *get_accepted_cargo_proc; |
|
317 |
GetTileDescProc *get_tile_desc_proc; |
|
318 |
GetTileTrackStatusProc *get_tile_track_status_proc; |
|
319 |
ClickTileProc *click_tile_proc; |
|
320 |
AnimateTileProc *animate_tile_proc; |
|
321 |
TileLoopProc *tile_loop_proc; |
|
322 |
ChangeTileOwnerProc *change_tile_owner_proc; |
|
323 |
GetProducedCargoProc *get_produced_cargo_proc; |
|
324 |
VehicleEnterTileProc *vehicle_enter_tile_proc; |
|
325 |
VehicleLeaveTileProc *vehicle_leave_tile_proc; |
|
39 | 326 |
GetSlopeTilehProc *get_slope_tileh_proc; |
0 | 327 |
} TileTypeProcs; |
328 |
||
329 |
||
330 |
||
331 |
#define MP_SETTYPE(x) ((x+1) << 8) |
|
332 |
||
333 |
enum { |
|
334 |
MP_MAP2 = 1<<0, |
|
335 |
MP_MAP3LO = 1<<1, |
|
336 |
MP_MAP3HI = 1<<2, |
|
337 |
MP_MAP5 = 1<<3, |
|
338 |
MP_MAPOWNER_CURRENT = 1<<4, |
|
339 |
MP_MAPOWNER = 1<<5, |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
168
diff
changeset
|
340 |
|
0 | 341 |
MP_TYPE_MASK = 0xF << 8, |
342 |
||
343 |
MP_MAP2_CLEAR = 1 << 12, |
|
344 |
MP_MAP3LO_CLEAR = 1 << 13, |
|
345 |
MP_MAP3HI_CLEAR = 1 << 14, |
|
346 |
||
347 |
MP_NODIRTY = 1<<15, |
|
348 |
}; |
|
349 |
||
350 |
enum { |
|
351 |
WC_MAIN_WINDOW = 0x0, |
|
352 |
WC_MAIN_TOOLBAR = 0x1, |
|
353 |
WC_STATUS_BAR = 0x2, |
|
354 |
WC_BUILD_TOOLBAR = 0x3, |
|
355 |
WC_NEWS_WINDOW = 0x4, |
|
356 |
WC_TOWN_DIRECTORY = 0x5, |
|
357 |
WC_STATION_LIST = 0x6, |
|
358 |
WC_TOWN_VIEW = 0x7, |
|
359 |
WC_SMALLMAP = 0x8, |
|
360 |
WC_TRAINS_LIST = 0x9, |
|
361 |
WC_ROADVEH_LIST = 0xA, |
|
362 |
WC_SHIPS_LIST = 0xB, |
|
363 |
WC_AIRCRAFT_LIST = 0xC, |
|
364 |
WC_VEHICLE_VIEW = 0xD, |
|
365 |
WC_VEHICLE_DETAILS = 0xE, |
|
366 |
WC_VEHICLE_REFIT = 0xF, |
|
367 |
WC_VEHICLE_ORDERS = 0x10, |
|
368 |
WC_STATION_VIEW = 0x11, |
|
369 |
WC_VEHICLE_DEPOT = 0x12, |
|
370 |
WC_BUILD_VEHICLE = 0x13, |
|
371 |
WC_BUILD_BRIDGE = 0x14, |
|
372 |
WC_ERRMSG = 0x15, |
|
373 |
WC_ASK_ABANDON_GAME = 0x16, |
|
374 |
WC_QUIT_GAME = 0x17, |
|
375 |
WC_BUILD_STATION = 0x18, |
|
376 |
WC_BUS_STATION = 0x19, |
|
377 |
WC_TRUCK_STATION = 0x1A, |
|
378 |
WC_BUILD_DEPOT = 0x1B, |
|
379 |
WC_DEBUGGER = 0x1C, |
|
380 |
WC_COMPANY = 0x1D, |
|
381 |
WC_FINANCES = 0x1E, |
|
382 |
WC_PLAYER_COLOR = 0x1F, |
|
383 |
WC_QUERY_STRING = 0x20, |
|
384 |
WC_SAVELOAD = 0x21, |
|
385 |
WC_SELECT_GAME = 0x22, |
|
386 |
WC_TOOLBAR_MENU = 0x24, |
|
387 |
WC_INCOME_GRAPH = 0x25, |
|
388 |
WC_OPERATING_PROFIT = 0x26, |
|
389 |
WC_TOOLTIPS = 0x27, |
|
390 |
WC_INDUSTRY_VIEW = 0x28, |
|
391 |
WC_PLAYER_FACE = 0x29, |
|
392 |
WC_LAND_INFO = 0x2A, |
|
393 |
WC_TOWN_AUTHORITY = 0x2B, |
|
394 |
WC_SUBSIDIES_LIST = 0x2C, |
|
395 |
WC_GRAPH_LEGEND = 0x2D, |
|
396 |
WC_DELIVERED_CARGO = 0x2E, |
|
397 |
WC_PERFORMANCE_HISTORY = 0x2F, |
|
398 |
WC_COMPANY_VALUE = 0x30, |
|
399 |
WC_COMPANY_LEAGUE = 0x31, |
|
400 |
WC_BUY_COMPANY = 0x32, |
|
401 |
WC_PAYMENT_RATES = 0x33, |
|
402 |
WC_SELECT_TUTORIAL = 0x34, |
|
403 |
WC_ENGINE_PREVIEW = 0x35, |
|
404 |
WC_MUSIC_WINDOW = 0x36, |
|
405 |
WC_MUSIC_TRACK_SELECTION = 0x37, |
|
606
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
543
diff
changeset
|
406 |
WC_SCEN_LAND_GEN = 0x38, // also used for landscaping toolbar |
0 | 407 |
WC_ASK_RESET_LANDSCAPE = 0x39, |
408 |
WC_SCEN_TOWN_GEN = 0x3A, |
|
409 |
WC_SCEN_INDUSTRY = 0x3B, |
|
410 |
WC_SCEN_BUILD_ROAD = 0x3C, |
|
606
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
543
diff
changeset
|
411 |
WC_BUILD_TREES = 0x3D, |
0 | 412 |
WC_SEND_NETWORK_MSG = 0x3E, |
413 |
WC_DROPDOWN_MENU = 0x3F, |
|
414 |
WC_BUILD_INDUSTRY = 0x40, |
|
415 |
WC_GAME_OPTIONS = 0x41, |
|
416 |
WC_NETWORK_WINDOW = 0x42, |
|
417 |
WC_INDUSTRY_DIRECTORY = 0x43, |
|
418 |
WC_MESSAGE_HISTORY = 0x44, |
|
419 |
WC_CHEATS = 0x45, |
|
152
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
126
diff
changeset
|
420 |
WC_PERFORMANCE_DETAIL = 0x46, |
126 | 421 |
WC_CONSOLE = 0x47, |
152
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
126
diff
changeset
|
422 |
WC_EXTRA_VIEW_PORT = 0x48, |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
513
diff
changeset
|
423 |
WC_CLIENT_LIST = 0x49, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
513
diff
changeset
|
424 |
WC_NETWORK_STATUS_WINDOW = 0x4A, |
759
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
663
diff
changeset
|
425 |
WC_CUSTOM_CURRENCY = 0x4B, |
842 | 426 |
WC_REPLACE_VEHICLE = 0x4C, |
983
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
970
diff
changeset
|
427 |
WC_HIGHSCORE_ENDSCREEN = 0x4D, |
0 | 428 |
}; |
429 |
||
430 |
||
431 |
enum { |
|
432 |
EXPENSES_CONSTRUCTION = 0, |
|
433 |
EXPENSES_NEW_VEHICLES = 1, |
|
434 |
EXPENSES_TRAIN_RUN = 2, |
|
435 |
EXPENSES_ROADVEH_RUN = 3, |
|
436 |
EXPENSES_AIRCRAFT_RUN = 4, |
|
437 |
EXPENSES_SHIP_RUN = 5, |
|
438 |
EXPENSES_PROPERTY = 6, |
|
439 |
EXPENSES_TRAIN_INC = 7, |
|
440 |
EXPENSES_ROADVEH_INC = 8, |
|
441 |
EXPENSES_AIRCRAFT_INC = 9, |
|
442 |
EXPENSES_SHIP_INC = 10, |
|
443 |
EXPENSES_LOAN_INT = 11, |
|
444 |
EXPENSES_OTHER = 12, |
|
445 |
}; |
|
446 |
||
447 |
// Tile type misc constants, don't know where to put these |
|
448 |
enum { |
|
449 |
TRACKTYPE_SPRITE_PITCH = 0x52, |
|
450 |
}; |
|
451 |
||
452 |
||
453 |
// special string constants |
|
454 |
enum SpecialStrings { |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
168
diff
changeset
|
455 |
|
0 | 456 |
// special strings for town names. the town name is generated dynamically on request. |
457 |
SPECSTR_TOWNNAME_START = 0x20C0, |
|
458 |
SPECSTR_TOWNNAME_ENGLISH = SPECSTR_TOWNNAME_START, |
|
459 |
SPECSTR_TOWNNAME_FRENCH, |
|
460 |
SPECSTR_TOWNNAME_GERMAN, |
|
461 |
SPECSTR_TOWNNAME_AMERICAN, |
|
462 |
SPECSTR_TOWNNAME_LATIN, |
|
463 |
SPECSTR_TOWNNAME_SILLY, |
|
464 |
SPECSTR_TOWNNAME_SWEDISH, |
|
465 |
SPECSTR_TOWNNAME_DUTCH, |
|
466 |
SPECSTR_TOWNNAME_FINNISH, |
|
467 |
SPECSTR_TOWNNAME_POLISH, |
|
468 |
SPECSTR_TOWNNAME_SLOVAKISH, |
|
948 | 469 |
SPECSTR_TOWNNAME_NORWEGIAN, |
0 | 470 |
SPECSTR_TOWNNAME_HUNGARIAN, |
265 | 471 |
SPECSTR_TOWNNAME_AUSTRIAN, |
472 |
SPECSTR_TOWNNAME_ROMANIAN, |
|
473 |
SPECSTR_TOWNNAME_CZECH, |
|
1030
24c0b0000bf0
(svn r1531) -Feature: [1039061] Swiss town-names (vulvulune)
darkvater
parents:
1004
diff
changeset
|
474 |
SPECSTR_TOWNNAME_SWISS, |
24c0b0000bf0
(svn r1531) -Feature: [1039061] Swiss town-names (vulvulune)
darkvater
parents:
1004
diff
changeset
|
475 |
SPECSTR_TOWNNAME_LAST = SPECSTR_TOWNNAME_SWISS, |
0 | 476 |
|
477 |
// special strings for player names on the form "TownName transport". |
|
478 |
SPECSTR_PLAYERNAME_START = 0x70EA, |
|
479 |
SPECSTR_PLAYERNAME_ENGLISH = SPECSTR_PLAYERNAME_START, |
|
480 |
SPECSTR_PLAYERNAME_FRENCH, |
|
481 |
SPECSTR_PLAYERNAME_GERMAN, |
|
482 |
SPECSTR_PLAYERNAME_AMERICAN, |
|
483 |
SPECSTR_PLAYERNAME_LATIN, |
|
484 |
SPECSTR_PLAYERNAME_SILLY, |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
168
diff
changeset
|
485 |
SPECSTR_PLAYERNAME_LAST = SPECSTR_PLAYERNAME_SILLY, |
0 | 486 |
|
487 |
SPECSTR_ANDCO_NAME = 0x70E6, |
|
488 |
SPECSTR_PRESIDENT_NAME = 0x70E7, |
|
489 |
SPECSTR_SONGNAME = 0x70E8, |
|
490 |
||
491 |
// reserve 32 strings for the *.lng files |
|
492 |
SPECSTR_LANGUAGE_START = 0x7100, |
|
493 |
SPECSTR_LANGUAGE_END = 0x711f, |
|
494 |
||
495 |
// reserve 32 strings for various screen resolutions |
|
496 |
SPECSTR_RESOLUTION_START = 0x7120, |
|
497 |
SPECSTR_RESOLUTION_END = 0x713f, |
|
498 |
||
499 |
// reserve 32 strings for screenshot formats |
|
500 |
SPECSTR_SCREENSHOT_START = 0x7140, |
|
501 |
SPECSTR_SCREENSHOT_END = 0x715F, |
|
502 |
||
503 |
STR_SPEC_SCREENSHOT_NAME = 0xF800, |
|
504 |
STR_SPEC_USERSTRING = 0xF801, |
|
505 |
}; |
|
506 |
||
507 |
typedef void PlaceProc(uint tile); |
|
508 |
||
509 |
VARDEF bool _savegame_sort_dirty; |
|
510 |
VARDEF byte _savegame_sort_order; |
|
511 |
||
512 |
#define INVALID_UINT_TILE (uint)0xFFFFFFFF |
|
513 |
#define INVALID_STRING_ID 0xFFFF |
|
514 |
||
515 |
enum { |
|
516 |
MAX_SCREEN_WIDTH = 2048, |
|
517 |
MAX_SCREEN_HEIGHT = 1200, |
|
518 |
}; |
|
519 |
||
1397
fa8539dcab46
(svn r1901) - Fix: unwanted behaviour of the savegame dialog, as well as a bug with a sloppy termination of a string. When any editbox is open, scrolling is disabled. If any new types of editboxes come up, please use SET/CLRBIT of _no_scroll with its unique identifier (ttd.h)
Darkvater
parents:
1363
diff
changeset
|
520 |
/* In certain windows you navigate with the arrow keys. Do not scroll the |
fa8539dcab46
(svn r1901) - Fix: unwanted behaviour of the savegame dialog, as well as a bug with a sloppy termination of a string. When any editbox is open, scrolling is disabled. If any new types of editboxes come up, please use SET/CLRBIT of _no_scroll with its unique identifier (ttd.h)
Darkvater
parents:
1363
diff
changeset
|
521 |
* gameview when here. Bitencoded variable that only allows scrolling if all |
fa8539dcab46
(svn r1901) - Fix: unwanted behaviour of the savegame dialog, as well as a bug with a sloppy termination of a string. When any editbox is open, scrolling is disabled. If any new types of editboxes come up, please use SET/CLRBIT of _no_scroll with its unique identifier (ttd.h)
Darkvater
parents:
1363
diff
changeset
|
522 |
* elements are zero */ |
fa8539dcab46
(svn r1901) - Fix: unwanted behaviour of the savegame dialog, as well as a bug with a sloppy termination of a string. When any editbox is open, scrolling is disabled. If any new types of editboxes come up, please use SET/CLRBIT of _no_scroll with its unique identifier (ttd.h)
Darkvater
parents:
1363
diff
changeset
|
523 |
enum { |
fa8539dcab46
(svn r1901) - Fix: unwanted behaviour of the savegame dialog, as well as a bug with a sloppy termination of a string. When any editbox is open, scrolling is disabled. If any new types of editboxes come up, please use SET/CLRBIT of _no_scroll with its unique identifier (ttd.h)
Darkvater
parents:
1363
diff
changeset
|
524 |
SCROLL_CON = 0, |
fa8539dcab46
(svn r1901) - Fix: unwanted behaviour of the savegame dialog, as well as a bug with a sloppy termination of a string. When any editbox is open, scrolling is disabled. If any new types of editboxes come up, please use SET/CLRBIT of _no_scroll with its unique identifier (ttd.h)
Darkvater
parents:
1363
diff
changeset
|
525 |
SCROLL_EDIT = 1, |
fa8539dcab46
(svn r1901) - Fix: unwanted behaviour of the savegame dialog, as well as a bug with a sloppy termination of a string. When any editbox is open, scrolling is disabled. If any new types of editboxes come up, please use SET/CLRBIT of _no_scroll with its unique identifier (ttd.h)
Darkvater
parents:
1363
diff
changeset
|
526 |
SCROLL_SAVE = 2, |
fa8539dcab46
(svn r1901) - Fix: unwanted behaviour of the savegame dialog, as well as a bug with a sloppy termination of a string. When any editbox is open, scrolling is disabled. If any new types of editboxes come up, please use SET/CLRBIT of _no_scroll with its unique identifier (ttd.h)
Darkvater
parents:
1363
diff
changeset
|
527 |
}; |
fa8539dcab46
(svn r1901) - Fix: unwanted behaviour of the savegame dialog, as well as a bug with a sloppy termination of a string. When any editbox is open, scrolling is disabled. If any new types of editboxes come up, please use SET/CLRBIT of _no_scroll with its unique identifier (ttd.h)
Darkvater
parents:
1363
diff
changeset
|
528 |
VARDEF byte _no_scroll; |
fa8539dcab46
(svn r1901) - Fix: unwanted behaviour of the savegame dialog, as well as a bug with a sloppy termination of a string. When any editbox is open, scrolling is disabled. If any new types of editboxes come up, please use SET/CLRBIT of _no_scroll with its unique identifier (ttd.h)
Darkvater
parents:
1363
diff
changeset
|
529 |
|
0 | 530 |
#include "functions.h" |
531 |
#include "variables.h" |
|
532 |
||
533 |
#endif /* TTD_H */ |