openttd.h

Go to the documentation of this file.
00001 /* $Id: openttd.h 14269 2008-09-07 22:14:48Z rubidium $ */
00004 #ifndef OPENTTD_H
00005 #define OPENTTD_H
00006 
00007 #ifndef VARDEF
00008 #define VARDEF extern
00009 #endif
00010 
00011 // Forward declarations of structs.
00012 struct Depot;
00013 struct Waypoint;
00014 struct Station;
00015 struct ViewPort;
00016 struct NewsItem;
00017 struct DrawPixelInfo;
00018 struct Group;
00019 typedef byte VehicleOrderID;  
00020 typedef byte LandscapeID;
00021 typedef uint16 EngineID;
00022 typedef uint16 UnitID;
00023 
00024 typedef EngineID *EngineList; 
00025 
00026 /* IDs used in Pools */
00027 typedef uint16 StationID;
00028 static const StationID INVALID_STATION = 0xFFFF;
00029 typedef uint16 RoadStopID;
00030 typedef uint16 DepotID;
00031 typedef uint16 WaypointID;
00032 typedef uint16 OrderID;
00033 typedef uint16 SignID;
00034 typedef uint16 GroupID;
00035 typedef uint16 EngineRenewID;
00036 typedef uint16 DestinationID;
00037 
00038 /* DestinationID must be at least as large as every these below, because it can
00039  * be any of them
00040  */
00041 assert_compile(sizeof(DestinationID) >= sizeof(DepotID));
00042 assert_compile(sizeof(DestinationID) >= sizeof(WaypointID));
00043 assert_compile(sizeof(DestinationID) >= sizeof(StationID));
00044 
00045 enum GameModes {
00046   GM_MENU,
00047   GM_NORMAL,
00048   GM_EDITOR
00049 };
00050 
00051 enum SwitchModes {
00052   SM_NONE            =  0,
00053   SM_NEWGAME         =  1,
00054   SM_EDITOR          =  2,
00055   SM_LOAD            =  3,
00056   SM_MENU            =  4,
00057   SM_SAVE            =  5,
00058   SM_GENRANDLAND     =  6,
00059   SM_LOAD_SCENARIO   =  9,
00060   SM_START_SCENARIO  = 10,
00061   SM_START_HEIGHTMAP = 11,
00062   SM_LOAD_HEIGHTMAP  = 12,
00063 };
00064 
00065 
00066 /* Modes for GenerateWorld */
00067 enum GenerateWorldModes {
00068   GW_NEWGAME   = 0,    /* Generate a map for a new game */
00069   GW_EMPTY     = 1,    /* Generate an empty map (sea-level) */
00070   GW_RANDOM    = 2,    /* Generate a random map for SE */
00071   GW_HEIGHTMAP = 3,    /* Generate a newgame from a heightmap */
00072 };
00073 
00074 /* Modes for InitializeGame, those are _bits_! */
00075 enum InitializeGameModes {
00076   IG_NONE       = 0,  /* Don't do anything special */
00077   IG_DATE_RESET = 1,  /* Reset the date when initializing a game */
00078 };
00079 
00080 enum TransportType {
00081   /* These constants are for now linked to the representation of bridges
00082    * and tunnels, so they can be used by GetTileTrackStatus_TunnelBridge.
00083    * In an ideal world, these constants would be used everywhere when
00084    * accessing tunnels and bridges. For now, you should just not change
00085    * the values for road and rail.
00086    */
00087   TRANSPORT_BEGIN = 0,
00088   TRANSPORT_RAIL = 0,
00089   TRANSPORT_ROAD = 1,
00090   TRANSPORT_WATER, // = 2
00091   TRANSPORT_END,
00092   INVALID_TRANSPORT = 0xff,
00093 };
00094 
00095 /* Display Options */
00096 enum {
00097   DO_SHOW_TOWN_NAMES    = 0,
00098   DO_SHOW_STATION_NAMES = 1,
00099   DO_SHOW_SIGNS         = 2,
00100   DO_FULL_ANIMATION     = 3,
00101   DO_FULL_DETAIL        = 5,
00102   DO_WAYPOINTS          = 6,
00103 };
00104 
00105 /* Landscape types */
00106 enum {
00107   LT_TEMPERATE  = 0,
00108   LT_ARCTIC     = 1,
00109   LT_TROPIC     = 2,
00110   LT_TOYLAND    = 3,
00111 
00112   NUM_LANDSCAPE = 4,
00113 };
00114 
00115 struct ViewportSign {
00116   int32 left;
00117   int32 top;
00118   uint16 width_1, width_2;
00119 };
00120 
00121 enum {
00122   SORT_ASCENDING  = 0,
00123   SORT_DESCENDING = 1,
00124   SORT_BY_DATE    = 0,
00125   SORT_BY_NAME    = 2
00126 };
00127 
00128 extern byte _savegame_sort_order;
00129 
00130 enum {
00131   MAX_SCREEN_WIDTH  = 2048,
00132   MAX_SCREEN_HEIGHT = 1200,
00133 };
00134 
00135 /* In certain windows you navigate with the arrow keys. Do not scroll the
00136  * gameview when here. Bitencoded variable that only allows scrolling if all
00137  * elements are zero */
00138 enum {
00139   SCROLL_CON  = 0,
00140   SCROLL_EDIT = 1,
00141   SCROLL_SAVE = 2,
00142   SCROLL_CHAT = 4,
00143 };
00144 extern byte _no_scroll;
00145 
00149 enum ThreadMsg {
00150   MSG_OTTD_NO_MESSAGE,
00151   MSG_OTTD_SAVETHREAD_DONE,
00152   MSG_OTTD_SAVETHREAD_ERROR,
00153 };
00154 
00155 void OTTD_SendThreadMessage(ThreadMsg msg);
00156 
00157 extern byte _game_mode;
00158 extern bool _exit_game;
00159 extern int8 _pause_game;
00160 
00161 #endif /* OPENTTD_H */

Generated on Mon Sep 22 20:34:17 2008 for openttd by  doxygen 1.5.6