2005-07-24 14:12:37 +00:00
|
|
|
/* $Id$ */
|
2005-10-19 08:34:37 +00:00
|
|
|
/** @file openttd.h */
|
2005-07-24 14:12:37 +00:00
|
|
|
|
2005-07-15 21:28:26 +00:00
|
|
|
#ifndef OPENTTD_H
|
|
|
|
#define OPENTTD_H
|
2004-08-09 17:04:08 +00:00
|
|
|
|
|
|
|
#ifndef VARDEF
|
|
|
|
#define VARDEF extern
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Forward declarations of structs.
|
2007-03-07 12:11:48 +00:00
|
|
|
struct Depot;
|
|
|
|
struct Waypoint;
|
|
|
|
struct Station;
|
|
|
|
struct ViewPort;
|
|
|
|
struct NewsItem;
|
|
|
|
struct DrawPixelInfo;
|
2007-05-19 09:40:18 +00:00
|
|
|
struct Group;
|
2006-08-26 17:12:24 +00:00
|
|
|
typedef byte VehicleOrderID; ///< The index of an order within its current vehicle (not pool related)
|
2006-05-12 00:27:12 +00:00
|
|
|
typedef byte LandscapeID;
|
2006-08-26 16:34:03 +00:00
|
|
|
typedef uint16 EngineID;
|
|
|
|
typedef uint16 UnitID;
|
2007-06-18 19:53:50 +00:00
|
|
|
|
2006-11-30 16:03:12 +00:00
|
|
|
typedef EngineID *EngineList; ///< engine list type placeholder acceptable for C code (see helpers.cpp)
|
2006-08-26 19:40:40 +00:00
|
|
|
|
|
|
|
/* IDs used in Pools */
|
|
|
|
typedef uint16 StationID;
|
2007-06-22 11:58:59 +00:00
|
|
|
static const StationID INVALID_STATION = 0xFFFF;
|
2006-08-26 19:40:40 +00:00
|
|
|
typedef uint16 RoadStopID;
|
|
|
|
typedef uint16 DepotID;
|
|
|
|
typedef uint16 WaypointID;
|
|
|
|
typedef uint16 OrderID;
|
|
|
|
typedef uint16 SignID;
|
2007-05-19 09:40:18 +00:00
|
|
|
typedef uint16 GroupID;
|
2006-08-26 19:40:40 +00:00
|
|
|
typedef uint16 EngineRenewID;
|
2006-09-03 08:25:27 +00:00
|
|
|
typedef uint16 DestinationID;
|
2007-10-20 14:51:09 +00:00
|
|
|
|
2006-09-03 08:25:27 +00:00
|
|
|
/* DestinationID must be at least as large as every these below, because it can
|
|
|
|
* be any of them
|
|
|
|
*/
|
|
|
|
assert_compile(sizeof(DestinationID) == sizeof(DepotID));
|
|
|
|
assert_compile(sizeof(DestinationID) == sizeof(WaypointID));
|
|
|
|
assert_compile(sizeof(DestinationID) == sizeof(StationID));
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2007-12-22 23:30:28 +00:00
|
|
|
enum GameModes {
|
|
|
|
GM_MENU,
|
|
|
|
GM_NORMAL,
|
|
|
|
GM_EDITOR
|
|
|
|
};
|
|
|
|
|
2004-08-09 17:04:08 +00:00
|
|
|
enum SwitchModes {
|
2006-08-22 14:38:37 +00:00
|
|
|
SM_NONE = 0,
|
|
|
|
SM_NEWGAME = 1,
|
|
|
|
SM_EDITOR = 2,
|
|
|
|
SM_LOAD = 3,
|
|
|
|
SM_MENU = 4,
|
|
|
|
SM_SAVE = 5,
|
|
|
|
SM_GENRANDLAND = 6,
|
|
|
|
SM_LOAD_SCENARIO = 9,
|
|
|
|
SM_START_SCENARIO = 10,
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
SM_START_HEIGHTMAP = 11,
|
2006-08-22 14:38:37 +00:00
|
|
|
SM_LOAD_HEIGHTMAP = 12,
|
2004-08-09 17:04:08 +00:00
|
|
|
};
|
|
|
|
|
2006-01-06 21:57:37 +00:00
|
|
|
|
|
|
|
/* Modes for GenerateWorld */
|
|
|
|
enum GenerateWorldModes {
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
GW_NEWGAME = 0, /* Generate a map for a new game */
|
|
|
|
GW_EMPTY = 1, /* Generate an empty map (sea-level) */
|
|
|
|
GW_RANDOM = 2, /* Generate a random map for SE */
|
|
|
|
GW_HEIGHTMAP = 3, /* Generate a newgame from a heightmap */
|
2006-01-06 21:57:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Modes for InitializeGame, those are _bits_! */
|
|
|
|
enum InitializeGameModes {
|
|
|
|
IG_NONE = 0, /* Don't do anything special */
|
|
|
|
IG_DATE_RESET = 1, /* Reset the date when initializing a game */
|
|
|
|
};
|
|
|
|
|
2007-03-07 12:11:48 +00:00
|
|
|
enum TransportType {
|
2004-09-05 16:15:22 +00:00
|
|
|
/* These constants are for now linked to the representation of bridges
|
2006-03-26 11:08:44 +00:00
|
|
|
* and tunnels, so they can be used by GetTileTrackStatus_TunnelBridge.
|
|
|
|
* In an ideal world, these constants would be used everywhere when
|
|
|
|
* accessing tunnels and bridges. For now, you should just not change
|
|
|
|
* the values for road and rail.
|
2004-09-05 16:15:22 +00:00
|
|
|
*/
|
2007-01-10 18:56:51 +00:00
|
|
|
TRANSPORT_BEGIN = 0,
|
2006-02-13 21:15:00 +00:00
|
|
|
TRANSPORT_RAIL = 0,
|
2004-09-05 16:15:22 +00:00
|
|
|
TRANSPORT_ROAD = 1,
|
2006-08-28 18:53:03 +00:00
|
|
|
TRANSPORT_WATER, // = 2
|
2005-06-22 22:38:18 +00:00
|
|
|
TRANSPORT_END,
|
|
|
|
INVALID_TRANSPORT = 0xff,
|
2007-03-07 12:11:48 +00:00
|
|
|
};
|
2004-09-05 16:15:22 +00:00
|
|
|
|
2004-08-09 17:04:08 +00:00
|
|
|
/* Display Options */
|
|
|
|
enum {
|
2007-05-07 11:24:23 +00:00
|
|
|
DO_SHOW_TOWN_NAMES = 0,
|
|
|
|
DO_SHOW_STATION_NAMES = 1,
|
|
|
|
DO_SHOW_SIGNS = 2,
|
|
|
|
DO_FULL_ANIMATION = 3,
|
|
|
|
DO_FULL_DETAIL = 5,
|
|
|
|
DO_WAYPOINTS = 6,
|
2007-04-05 07:49:04 +00:00
|
|
|
};
|
|
|
|
|
2004-08-09 17:04:08 +00:00
|
|
|
/* Landscape types */
|
|
|
|
enum {
|
2007-03-22 03:42:43 +00:00
|
|
|
LT_TEMPERATE = 0,
|
|
|
|
LT_ARCTIC = 1,
|
|
|
|
LT_TROPIC = 2,
|
|
|
|
LT_TOYLAND = 3,
|
2004-08-09 17:04:08 +00:00
|
|
|
|
|
|
|
NUM_LANDSCAPE = 4,
|
|
|
|
};
|
|
|
|
|
2007-03-07 12:11:48 +00:00
|
|
|
struct ViewportSign {
|
2005-01-03 08:50:44 +00:00
|
|
|
int32 left;
|
|
|
|
int32 top;
|
2004-08-09 17:04:08 +00:00
|
|
|
byte width_1, width_2;
|
2007-03-07 12:11:48 +00:00
|
|
|
};
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2005-10-17 19:57:00 +00:00
|
|
|
enum {
|
|
|
|
SORT_ASCENDING = 0,
|
|
|
|
SORT_DESCENDING = 1,
|
|
|
|
SORT_BY_DATE = 0,
|
|
|
|
SORT_BY_NAME = 2
|
|
|
|
};
|
|
|
|
|
2008-01-13 13:36:01 +00:00
|
|
|
extern byte _savegame_sort_order;
|
2004-08-09 17:04:08 +00:00
|
|
|
|
|
|
|
enum {
|
2006-08-22 14:38:37 +00:00
|
|
|
MAX_SCREEN_WIDTH = 2048,
|
2004-08-09 17:04:08 +00:00
|
|
|
MAX_SCREEN_HEIGHT = 1200,
|
|
|
|
};
|
|
|
|
|
2005-02-22 14:52:20 +00:00
|
|
|
/* In certain windows you navigate with the arrow keys. Do not scroll the
|
|
|
|
* gameview when here. Bitencoded variable that only allows scrolling if all
|
|
|
|
* elements are zero */
|
|
|
|
enum {
|
2006-08-22 14:38:37 +00:00
|
|
|
SCROLL_CON = 0,
|
2005-02-22 14:52:20 +00:00
|
|
|
SCROLL_EDIT = 1,
|
|
|
|
SCROLL_SAVE = 2,
|
2005-05-17 23:25:18 +00:00
|
|
|
SCROLL_CHAT = 4,
|
2005-02-22 14:52:20 +00:00
|
|
|
};
|
2008-01-13 13:36:01 +00:00
|
|
|
extern byte _no_scroll;
|
2005-02-22 14:52:20 +00:00
|
|
|
|
2005-09-02 16:05:59 +00:00
|
|
|
/** To have a concurrently running thread interface with the main program, use
|
|
|
|
* the OTTD_SendThreadMessage() function. Actions to perform upon the message are handled
|
|
|
|
* in the ProcessSentMessage() function */
|
2007-03-07 12:11:48 +00:00
|
|
|
enum ThreadMsg {
|
2006-08-20 13:39:33 +00:00
|
|
|
MSG_OTTD_NO_MESSAGE,
|
|
|
|
MSG_OTTD_SAVETHREAD_DONE,
|
|
|
|
MSG_OTTD_SAVETHREAD_ERROR,
|
2007-03-07 12:11:48 +00:00
|
|
|
};
|
2005-09-02 16:05:59 +00:00
|
|
|
|
|
|
|
void OTTD_SendThreadMessage(ThreadMsg msg);
|
|
|
|
|
2007-12-22 23:30:28 +00:00
|
|
|
extern byte _game_mode;
|
|
|
|
extern bool _exit_game;
|
|
|
|
extern byte _pause_game;
|
|
|
|
|
2005-07-15 21:28:26 +00:00
|
|
|
#endif /* OPENTTD_H */
|