src/openttd.h
branchnoai
changeset 9724 b39bc69bb2f2
parent 9723 eee46cb39750
child 9826 9707ad4c9b60
equal deleted inserted replaced
9723:eee46cb39750 9724:b39bc69bb2f2
     5 #define OPENTTD_H
     5 #define OPENTTD_H
     6 
     6 
     7 #ifndef VARDEF
     7 #ifndef VARDEF
     8 #define VARDEF extern
     8 #define VARDEF extern
     9 #endif
     9 #endif
    10 
       
    11 #include "core/enum_type.hpp"
       
    12 #include "strings_type.h"
       
    13 
    10 
    14 // Forward declarations of structs.
    11 // Forward declarations of structs.
    15 struct Depot;
    12 struct Depot;
    16 struct Waypoint;
    13 struct Waypoint;
    17 struct Station;
    14 struct Station;
    39 typedef uint16 DestinationID;
    36 typedef uint16 DestinationID;
    40 
    37 
    41 /* DestinationID must be at least as large as every these below, because it can
    38 /* DestinationID must be at least as large as every these below, because it can
    42  * be any of them
    39  * be any of them
    43  */
    40  */
    44 assert_compile(sizeof(DestinationID) == sizeof(DepotID));
    41 assert_compile(sizeof(DestinationID) >= sizeof(DepotID));
    45 assert_compile(sizeof(DestinationID) == sizeof(WaypointID));
    42 assert_compile(sizeof(DestinationID) >= sizeof(WaypointID));
    46 assert_compile(sizeof(DestinationID) == sizeof(StationID));
    43 assert_compile(sizeof(DestinationID) >= sizeof(StationID));
    47 
       
    48 typedef uint32 PlayerFace; ///< player face bits, info see in player_face.h
       
    49 
    44 
    50 enum GameModes {
    45 enum GameModes {
    51 	GM_MENU,
    46 	GM_MENU,
    52 	GM_NORMAL,
    47 	GM_NORMAL,
    53 	GM_EDITOR
    48 	GM_EDITOR
    80 enum InitializeGameModes {
    75 enum InitializeGameModes {
    81 	IG_NONE       = 0,  /* Don't do anything special */
    76 	IG_NONE       = 0,  /* Don't do anything special */
    82 	IG_DATE_RESET = 1,  /* Reset the date when initializing a game */
    77 	IG_DATE_RESET = 1,  /* Reset the date when initializing a game */
    83 };
    78 };
    84 
    79 
    85 enum Owner {
       
    86 	PLAYER_INACTIVE_CLIENT = 253,
       
    87 	PLAYER_NEW_COMPANY = 254,
       
    88 	PLAYER_SPECTATOR = 255,
       
    89 	OWNER_BEGIN     = 0x00,
       
    90 	PLAYER_FIRST    = 0x00,
       
    91 	MAX_PLAYERS     = 8,
       
    92 	OWNER_TOWN      = 0x0F, // a town owns the tile
       
    93 	OWNER_NONE      = 0x10, // nobody owns the tile
       
    94 	OWNER_WATER     = 0x11, // "water" owns the tile
       
    95 	OWNER_END       = 0x12,
       
    96 	INVALID_OWNER   = 0xFF,
       
    97 	INVALID_PLAYER  = 0xFF,
       
    98 	/* Player identifiers All players below MAX_PLAYERS are playable
       
    99 	* players, above, they are special, computer controlled players */
       
   100 };
       
   101 
       
   102 typedef Owner PlayerID;
       
   103 
       
   104 DECLARE_POSTFIX_INCREMENT(Owner);
       
   105 
       
   106 /** Define basic enum properties */
       
   107 template <> struct EnumPropsT<Owner> : MakeEnumPropsT<Owner, byte, OWNER_BEGIN, OWNER_END, INVALID_OWNER> {};
       
   108 typedef TinyEnumT<Owner> OwnerByte;
       
   109 typedef OwnerByte PlayerByte;
       
   110 
       
   111 
       
   112 enum TransportType {
    80 enum TransportType {
   113 	/* These constants are for now linked to the representation of bridges
    81 	/* These constants are for now linked to the representation of bridges
   114 	 * and tunnels, so they can be used by GetTileTrackStatus_TunnelBridge.
    82 	 * and tunnels, so they can be used by GetTileTrackStatus_TunnelBridge.
   115 	 * In an ideal world, these constants would be used everywhere when
    83 	 * In an ideal world, these constants would be used everywhere when
   116 	 * accessing tunnels and bridges. For now, you should just not change
    84 	 * accessing tunnels and bridges. For now, you should just not change
   121 	TRANSPORT_ROAD = 1,
    89 	TRANSPORT_ROAD = 1,
   122 	TRANSPORT_WATER, // = 2
    90 	TRANSPORT_WATER, // = 2
   123 	TRANSPORT_END,
    91 	TRANSPORT_END,
   124 	INVALID_TRANSPORT = 0xff,
    92 	INVALID_TRANSPORT = 0xff,
   125 };
    93 };
   126 
       
   127 /** Define basic enum properties */
       
   128 template <> struct EnumPropsT<TransportType> : MakeEnumPropsT<TransportType, byte, TRANSPORT_BEGIN, TRANSPORT_END, INVALID_TRANSPORT> {};
       
   129 typedef TinyEnumT<TransportType> TransportTypeByte;
       
   130 
       
   131 
    94 
   132 /* Display Options */
    95 /* Display Options */
   133 enum {
    96 enum {
   134 	DO_SHOW_TOWN_NAMES    = 0,
    97 	DO_SHOW_TOWN_NAMES    = 0,
   135 	DO_SHOW_STATION_NAMES = 1,
    98 	DO_SHOW_STATION_NAMES = 1,
   147 	LT_TOYLAND    = 3,
   110 	LT_TOYLAND    = 3,
   148 
   111 
   149 	NUM_LANDSCAPE = 4,
   112 	NUM_LANDSCAPE = 4,
   150 };
   113 };
   151 
   114 
   152 #define GAME_DIFFICULTY_NUM 18
       
   153 
       
   154 /** Specific type for Game Difficulty to ease changing the type */
       
   155 typedef uint16 GDType;
       
   156 struct GameDifficulty {
       
   157 	GDType max_no_competitors;
       
   158 	GDType competitor_start_time;
       
   159 	GDType number_towns;
       
   160 	GDType number_industries;
       
   161 	GDType max_loan;
       
   162 	GDType initial_interest;
       
   163 	GDType vehicle_costs;
       
   164 	GDType competitor_speed;
       
   165 	GDType competitor_intelligence; // no longer in use
       
   166 	GDType vehicle_breakdowns;
       
   167 	GDType subsidy_multiplier;
       
   168 	GDType construction_cost;
       
   169 	GDType terrain_type;
       
   170 	GDType quantity_sea_lakes;
       
   171 	GDType economy;
       
   172 	GDType line_reverse_mode;
       
   173 	GDType disasters;
       
   174 	GDType town_council_tolerance; // minimum required town ratings to be allowed to demolish stuff
       
   175 };
       
   176 
       
   177 struct ViewportSign {
   115 struct ViewportSign {
   178 	int32 left;
   116 	int32 left;
   179 	int32 top;
   117 	int32 top;
   180 	byte width_1, width_2;
   118 	byte width_1, width_2;
   181 };
   119 };
   185 	SORT_DESCENDING = 1,
   123 	SORT_DESCENDING = 1,
   186 	SORT_BY_DATE    = 0,
   124 	SORT_BY_DATE    = 0,
   187 	SORT_BY_NAME    = 2
   125 	SORT_BY_NAME    = 2
   188 };
   126 };
   189 
   127 
   190 VARDEF byte _savegame_sort_order;
   128 extern byte _savegame_sort_order;
   191 
   129 
   192 enum {
   130 enum {
   193 	MAX_SCREEN_WIDTH  = 2048,
   131 	MAX_SCREEN_WIDTH  = 2048,
   194 	MAX_SCREEN_HEIGHT = 1200,
   132 	MAX_SCREEN_HEIGHT = 1200,
   195 };
   133 };
   201 	SCROLL_CON  = 0,
   139 	SCROLL_CON  = 0,
   202 	SCROLL_EDIT = 1,
   140 	SCROLL_EDIT = 1,
   203 	SCROLL_SAVE = 2,
   141 	SCROLL_SAVE = 2,
   204 	SCROLL_CHAT = 4,
   142 	SCROLL_CHAT = 4,
   205 };
   143 };
   206 VARDEF byte _no_scroll;
   144 extern byte _no_scroll;
   207 
   145 
   208 /** To have a concurrently running thread interface with the main program, use
   146 /** To have a concurrently running thread interface with the main program, use
   209  * the OTTD_SendThreadMessage() function. Actions to perform upon the message are handled
   147  * the OTTD_SendThreadMessage() function. Actions to perform upon the message are handled
   210  * in the ProcessSentMessage() function */
   148  * in the ProcessSentMessage() function */
   211 enum ThreadMsg {
   149 enum ThreadMsg {