author | rubidium |
Tue, 06 May 2008 15:11:33 +0000 | |
changeset 9111 | 48ce04029fe4 |
parent 9080 | 34bc7cbbb79a |
child 9126 | 5648d696456b |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
8989
42f45270fbca
(svn r12784) -Codechange: handle the asynchronious save 'handlers' in saveload.cpp instead of openttd.cpp.
rubidium
parents:
8985
diff
changeset
|
2 |
|
9111
48ce04029fe4
(svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium
parents:
9080
diff
changeset
|
3 |
/** @file openttd.h Some generic types. */ |
2186 | 4 |
|
2075
21d2986569d1
(svn r2585) - Fix [Makefile]: some small cleanups, remove warnings, and add mersenne to makefile (Luca)
Darkvater
parents:
2055
diff
changeset
|
5 |
#ifndef OPENTTD_H |
21d2986569d1
(svn r2585) - Fix [Makefile]: some small cleanups, remove warnings, and add mersenne to makefile (Luca)
Darkvater
parents:
2055
diff
changeset
|
6 |
#define OPENTTD_H |
0 | 7 |
|
8 |
#ifndef VARDEF |
|
9 |
#define VARDEF extern |
|
10 |
#endif |
|
11 |
||
12 |
// Forward declarations of structs. |
|
4401
ca197fcb332b
(svn r6154) -Cleanup: ordered the IDs that have to do with pools from the others
truelight
parents:
4397
diff
changeset
|
13 |
typedef byte LandscapeID; |
ca197fcb332b
(svn r6154) -Cleanup: ordered the IDs that have to do with pools from the others
truelight
parents:
4397
diff
changeset
|
14 |
typedef uint16 UnitID; |
6950
14ecb0acdfb4
(svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents:
6943
diff
changeset
|
15 |
|
8121
3bc6351e7369
(svn r11682) -Codechange: move some 'generic' geometry related types into a single file and do not include gfx.h everywhere to get a Point type.
rubidium
parents:
8119
diff
changeset
|
16 |
enum GameModes { |
3bc6351e7369
(svn r11682) -Codechange: move some 'generic' geometry related types into a single file and do not include gfx.h everywhere to get a Point type.
rubidium
parents:
8119
diff
changeset
|
17 |
GM_MENU, |
3bc6351e7369
(svn r11682) -Codechange: move some 'generic' geometry related types into a single file and do not include gfx.h everywhere to get a Point type.
rubidium
parents:
8119
diff
changeset
|
18 |
GM_NORMAL, |
3bc6351e7369
(svn r11682) -Codechange: move some 'generic' geometry related types into a single file and do not include gfx.h everywhere to get a Point type.
rubidium
parents:
8119
diff
changeset
|
19 |
GM_EDITOR |
3bc6351e7369
(svn r11682) -Codechange: move some 'generic' geometry related types into a single file and do not include gfx.h everywhere to get a Point type.
rubidium
parents:
8119
diff
changeset
|
20 |
}; |
3bc6351e7369
(svn r11682) -Codechange: move some 'generic' geometry related types into a single file and do not include gfx.h everywhere to get a Point type.
rubidium
parents:
8119
diff
changeset
|
21 |
|
0 | 22 |
enum SwitchModes { |
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4330
diff
changeset
|
23 |
SM_NONE = 0, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4330
diff
changeset
|
24 |
SM_NEWGAME = 1, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4330
diff
changeset
|
25 |
SM_EDITOR = 2, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4330
diff
changeset
|
26 |
SM_LOAD = 3, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4330
diff
changeset
|
27 |
SM_MENU = 4, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4330
diff
changeset
|
28 |
SM_SAVE = 5, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4330
diff
changeset
|
29 |
SM_GENRANDLAND = 6, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4330
diff
changeset
|
30 |
SM_LOAD_SCENARIO = 9, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4330
diff
changeset
|
31 |
SM_START_SCENARIO = 10, |
4300
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4297
diff
changeset
|
32 |
SM_START_HEIGHTMAP = 11, |
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4330
diff
changeset
|
33 |
SM_LOAD_HEIGHTMAP = 12, |
0 | 34 |
}; |
35 |
||
2828
342f02f7c0d4
(svn r3376) -Codechange: made enums for GenerateWorld and InitializeGame 'mode'
truelight
parents:
2794
diff
changeset
|
36 |
|
342f02f7c0d4
(svn r3376) -Codechange: made enums for GenerateWorld and InitializeGame 'mode'
truelight
parents:
2794
diff
changeset
|
37 |
/* Modes for GenerateWorld */ |
342f02f7c0d4
(svn r3376) -Codechange: made enums for GenerateWorld and InitializeGame 'mode'
truelight
parents:
2794
diff
changeset
|
38 |
enum GenerateWorldModes { |
4300
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4297
diff
changeset
|
39 |
GW_NEWGAME = 0, /* Generate a map for a new game */ |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4297
diff
changeset
|
40 |
GW_EMPTY = 1, /* Generate an empty map (sea-level) */ |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4297
diff
changeset
|
41 |
GW_RANDOM = 2, /* Generate a random map for SE */ |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4297
diff
changeset
|
42 |
GW_HEIGHTMAP = 3, /* Generate a newgame from a heightmap */ |
2828
342f02f7c0d4
(svn r3376) -Codechange: made enums for GenerateWorld and InitializeGame 'mode'
truelight
parents:
2794
diff
changeset
|
43 |
}; |
342f02f7c0d4
(svn r3376) -Codechange: made enums for GenerateWorld and InitializeGame 'mode'
truelight
parents:
2794
diff
changeset
|
44 |
|
342f02f7c0d4
(svn r3376) -Codechange: made enums for GenerateWorld and InitializeGame 'mode'
truelight
parents:
2794
diff
changeset
|
45 |
/* Modes for InitializeGame, those are _bits_! */ |
342f02f7c0d4
(svn r3376) -Codechange: made enums for GenerateWorld and InitializeGame 'mode'
truelight
parents:
2794
diff
changeset
|
46 |
enum InitializeGameModes { |
342f02f7c0d4
(svn r3376) -Codechange: made enums for GenerateWorld and InitializeGame 'mode'
truelight
parents:
2794
diff
changeset
|
47 |
IG_NONE = 0, /* Don't do anything special */ |
342f02f7c0d4
(svn r3376) -Codechange: made enums for GenerateWorld and InitializeGame 'mode'
truelight
parents:
2794
diff
changeset
|
48 |
IG_DATE_RESET = 1, /* Reset the date when initializing a game */ |
342f02f7c0d4
(svn r3376) -Codechange: made enums for GenerateWorld and InitializeGame 'mode'
truelight
parents:
2794
diff
changeset
|
49 |
}; |
342f02f7c0d4
(svn r3376) -Codechange: made enums for GenerateWorld and InitializeGame 'mode'
truelight
parents:
2794
diff
changeset
|
50 |
|
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
5991
diff
changeset
|
51 |
enum TransportType { |
159
139cf78bfb28
(svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents:
152
diff
changeset
|
52 |
/* These constants are for now linked to the representation of bridges |
3333 | 53 |
* and tunnels, so they can be used by GetTileTrackStatus_TunnelBridge. |
54 |
* In an ideal world, these constants would be used everywhere when |
|
55 |
* accessing tunnels and bridges. For now, you should just not change |
|
56 |
* the values for road and rail. |
|
159
139cf78bfb28
(svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents:
152
diff
changeset
|
57 |
*/ |
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5475
diff
changeset
|
58 |
TRANSPORT_BEGIN = 0, |
9080
34bc7cbbb79a
(svn r12939) -Codechange: do not use the window proc to determine whether a toolbar is a rail toolbar, but use the window number.
rubidium
parents:
8989
diff
changeset
|
59 |
TRANSPORT_RAIL = TRANSPORT_BEGIN, |
34bc7cbbb79a
(svn r12939) -Codechange: do not use the window proc to determine whether a toolbar is a rail toolbar, but use the window number.
rubidium
parents:
8989
diff
changeset
|
60 |
TRANSPORT_ROAD, |
34bc7cbbb79a
(svn r12939) -Codechange: do not use the window proc to determine whether a toolbar is a rail toolbar, but use the window number.
rubidium
parents:
8989
diff
changeset
|
61 |
TRANSPORT_WATER, |
34bc7cbbb79a
(svn r12939) -Codechange: do not use the window proc to determine whether a toolbar is a rail toolbar, but use the window number.
rubidium
parents:
8989
diff
changeset
|
62 |
TRANSPORT_AIR, |
1967
a01f4d5dd957
(svn r2473) - Add: VehicleMayEnterTile(), which checks if the tile owner of a tile is correct for a vehicle to enter it. Based upon glx's code.
matthijs
parents:
1932
diff
changeset
|
63 |
TRANSPORT_END, |
a01f4d5dd957
(svn r2473) - Add: VehicleMayEnterTile(), which checks if the tile owner of a tile is correct for a vehicle to enter it. Based upon glx's code.
matthijs
parents:
1932
diff
changeset
|
64 |
INVALID_TRANSPORT = 0xff, |
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
5991
diff
changeset
|
65 |
}; |
159
139cf78bfb28
(svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents:
152
diff
changeset
|
66 |
|
0 | 67 |
/* Display Options */ |
68 |
enum { |
|
6591
514c1a22e10e
(svn r9805) -Codechange: Use HASBIT() et al for display options bits.
peter1138
parents:
6577
diff
changeset
|
69 |
DO_SHOW_TOWN_NAMES = 0, |
514c1a22e10e
(svn r9805) -Codechange: Use HASBIT() et al for display options bits.
peter1138
parents:
6577
diff
changeset
|
70 |
DO_SHOW_STATION_NAMES = 1, |
514c1a22e10e
(svn r9805) -Codechange: Use HASBIT() et al for display options bits.
peter1138
parents:
6577
diff
changeset
|
71 |
DO_SHOW_SIGNS = 2, |
514c1a22e10e
(svn r9805) -Codechange: Use HASBIT() et al for display options bits.
peter1138
parents:
6577
diff
changeset
|
72 |
DO_FULL_ANIMATION = 3, |
514c1a22e10e
(svn r9805) -Codechange: Use HASBIT() et al for display options bits.
peter1138
parents:
6577
diff
changeset
|
73 |
DO_FULL_DETAIL = 5, |
514c1a22e10e
(svn r9805) -Codechange: Use HASBIT() et al for display options bits.
peter1138
parents:
6577
diff
changeset
|
74 |
DO_WAYPOINTS = 6, |
6427
7dc1012757d8
(svn r9563) -Feature: Add more finer control to transparency options, including a new toolbar, accessible from the map menu or Ctrl X. Patch by Wolf01.
peter1138
parents:
6357
diff
changeset
|
75 |
}; |
7dc1012757d8
(svn r9563) -Feature: Add more finer control to transparency options, including a new toolbar, accessible from the map menu or Ctrl X. Patch by Wolf01.
peter1138
parents:
6357
diff
changeset
|
76 |
|
0 | 77 |
/* Landscape types */ |
78 |
enum { |
|
6357
f0f5e7d1713c
(svn r9400) -Codechange: Use some more representative enum names for landscape types.
belugas
parents:
6248
diff
changeset
|
79 |
LT_TEMPERATE = 0, |
f0f5e7d1713c
(svn r9400) -Codechange: Use some more representative enum names for landscape types.
belugas
parents:
6248
diff
changeset
|
80 |
LT_ARCTIC = 1, |
f0f5e7d1713c
(svn r9400) -Codechange: Use some more representative enum names for landscape types.
belugas
parents:
6248
diff
changeset
|
81 |
LT_TROPIC = 2, |
f0f5e7d1713c
(svn r9400) -Codechange: Use some more representative enum names for landscape types.
belugas
parents:
6248
diff
changeset
|
82 |
LT_TOYLAND = 3, |
0 | 83 |
|
84 |
NUM_LANDSCAPE = 4, |
|
85 |
}; |
|
86 |
||
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
5991
diff
changeset
|
87 |
struct ViewportSign { |
849
c3407041774f
(svn r1330) Increase size of some vars from int16 to int32 to guard against future overflows
tron
parents:
842
diff
changeset
|
88 |
int32 left; |
c3407041774f
(svn r1330) Increase size of some vars from int16 to int32 to guard against future overflows
tron
parents:
842
diff
changeset
|
89 |
int32 top; |
0 | 90 |
byte width_1, width_2; |
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
5991
diff
changeset
|
91 |
}; |
0 | 92 |
|
2526
29eef390cabb
(svn r3055) Give the savegame/scenarion sort order flags symbolic names
tron
parents:
2436
diff
changeset
|
93 |
enum { |
29eef390cabb
(svn r3055) Give the savegame/scenarion sort order flags symbolic names
tron
parents:
2436
diff
changeset
|
94 |
SORT_ASCENDING = 0, |
29eef390cabb
(svn r3055) Give the savegame/scenarion sort order flags symbolic names
tron
parents:
2436
diff
changeset
|
95 |
SORT_DESCENDING = 1, |
29eef390cabb
(svn r3055) Give the savegame/scenarion sort order flags symbolic names
tron
parents:
2436
diff
changeset
|
96 |
SORT_BY_DATE = 0, |
29eef390cabb
(svn r3055) Give the savegame/scenarion sort order flags symbolic names
tron
parents:
2436
diff
changeset
|
97 |
SORT_BY_NAME = 2 |
29eef390cabb
(svn r3055) Give the savegame/scenarion sort order flags symbolic names
tron
parents:
2436
diff
changeset
|
98 |
}; |
29eef390cabb
(svn r3055) Give the savegame/scenarion sort order flags symbolic names
tron
parents:
2436
diff
changeset
|
99 |
|
8268
5027ad5e70a0
(svn r11832) -Codechange: get rid of (quite) some VARDEFs.
rubidium
parents:
8264
diff
changeset
|
100 |
extern byte _savegame_sort_order; |
0 | 101 |
|
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
|
102 |
/* 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
|
103 |
* 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
|
104 |
* 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
|
105 |
enum { |
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4330
diff
changeset
|
106 |
SCROLL_CON = 0, |
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
|
107 |
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
|
108 |
SCROLL_SAVE = 2, |
1843
8e2628948b01
(svn r2348) - Fix: Do not scroll the game with the arrow keys when the chatbox is open
Darkvater
parents:
1802
diff
changeset
|
109 |
SCROLL_CHAT = 4, |
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
|
110 |
}; |
8268
5027ad5e70a0
(svn r11832) -Codechange: get rid of (quite) some VARDEFs.
rubidium
parents:
8264
diff
changeset
|
111 |
extern byte _no_scroll; |
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
|
112 |
|
8121
3bc6351e7369
(svn r11682) -Codechange: move some 'generic' geometry related types into a single file and do not include gfx.h everywhere to get a Point type.
rubidium
parents:
8119
diff
changeset
|
113 |
extern byte _game_mode; |
3bc6351e7369
(svn r11682) -Codechange: move some 'generic' geometry related types into a single file and do not include gfx.h everywhere to get a Point type.
rubidium
parents:
8119
diff
changeset
|
114 |
extern bool _exit_game; |
8670
4f8e4590be7f
(svn r12335) -Codechange: Don't stuff signed values into a unsigned variable when the variable can just be unsigned...
peter1138
parents:
8324
diff
changeset
|
115 |
extern int8 _pause_game; |
8121
3bc6351e7369
(svn r11682) -Codechange: move some 'generic' geometry related types into a single file and do not include gfx.h everywhere to get a Point type.
rubidium
parents:
8119
diff
changeset
|
116 |
|
2075
21d2986569d1
(svn r2585) - Fix [Makefile]: some small cleanups, remove warnings, and add mersenne to makefile (Luca)
Darkvater
parents:
2055
diff
changeset
|
117 |
#endif /* OPENTTD_H */ |