src/openttd.h
branchnoai
changeset 9723 eee46cb39750
parent 9722 ebf0ece7d8f6
child 9724 b39bc69bb2f2
equal deleted inserted replaced
9722:ebf0ece7d8f6 9723:eee46cb39750
     6 
     6 
     7 #ifndef VARDEF
     7 #ifndef VARDEF
     8 #define VARDEF extern
     8 #define VARDEF extern
     9 #endif
     9 #endif
    10 
    10 
    11 #include "helpers.hpp"
    11 #include "core/enum_type.hpp"
    12 
    12 #include "strings_type.h"
    13 struct Oblong {
       
    14 	int x, y;
       
    15 	int width, height;
       
    16 };
       
    17 
       
    18 struct BoundingRect {
       
    19 	int width;
       
    20 	int height;
       
    21 };
       
    22 
       
    23 struct Pair {
       
    24 	int a;
       
    25 	int b;
       
    26 };
       
    27 
       
    28 #include "map.h"
       
    29 #include "slope.h"
       
    30 
    13 
    31 // Forward declarations of structs.
    14 // Forward declarations of structs.
    32 struct Vehicle;
       
    33 struct Depot;
    15 struct Depot;
    34 struct Waypoint;
    16 struct Waypoint;
    35 struct Window;
       
    36 struct Station;
    17 struct Station;
    37 struct ViewPort;
    18 struct ViewPort;
    38 struct Town;
       
    39 struct NewsItem;
    19 struct NewsItem;
    40 struct Industry;
       
    41 struct DrawPixelInfo;
    20 struct DrawPixelInfo;
    42 struct Group;
    21 struct Group;
    43 typedef byte VehicleOrderID;  ///< The index of an order within its current vehicle (not pool related)
    22 typedef byte VehicleOrderID;  ///< The index of an order within its current vehicle (not pool related)
    44 typedef byte CargoID;
       
    45 typedef byte LandscapeID;
    23 typedef byte LandscapeID;
    46 typedef uint32 SpriteID;      ///< The number of a sprite, without mapping bits and colortables
       
    47 struct PalSpriteID {
       
    48 	SpriteID sprite;
       
    49 	SpriteID pal;
       
    50 };
       
    51 typedef uint16 EngineID;
    24 typedef uint16 EngineID;
    52 typedef uint16 UnitID;
    25 typedef uint16 UnitID;
    53 typedef uint16 StringID;
       
    54 static const StringID INVALID_STRING_ID = 0xFFFF;
       
    55 
    26 
    56 typedef EngineID *EngineList; ///< engine list type placeholder acceptable for C code (see helpers.cpp)
    27 typedef EngineID *EngineList; ///< engine list type placeholder acceptable for C code (see helpers.cpp)
    57 
    28 
    58 /* IDs used in Pools */
    29 /* IDs used in Pools */
    59 typedef uint16 VehicleID;
       
    60 typedef uint16 StationID;
    30 typedef uint16 StationID;
    61 static const StationID INVALID_STATION = 0xFFFF;
    31 static const StationID INVALID_STATION = 0xFFFF;
    62 typedef uint16 RoadStopID;
    32 typedef uint16 RoadStopID;
    63 typedef uint16 TownID;
       
    64 typedef uint16 IndustryID;
       
    65 typedef uint16 DepotID;
    33 typedef uint16 DepotID;
    66 typedef uint16 WaypointID;
    34 typedef uint16 WaypointID;
    67 typedef uint16 OrderID;
    35 typedef uint16 OrderID;
    68 typedef uint16 SignID;
    36 typedef uint16 SignID;
    69 typedef uint16 GroupID;
    37 typedef uint16 GroupID;
    70 typedef uint16 EngineRenewID;
    38 typedef uint16 EngineRenewID;
    71 typedef uint16 DestinationID;
    39 typedef uint16 DestinationID;
    72 
    40 
    73 typedef OverflowSafeInt<int64, INT64_MAX, INT64_MIN> OverflowSafeInt64;
       
    74 typedef OverflowSafeInt64 Money;
       
    75 
       
    76 /* DestinationID must be at least as large as every these below, because it can
    41 /* DestinationID must be at least as large as every these below, because it can
    77  * be any of them
    42  * be any of them
    78  */
    43  */
    79 assert_compile(sizeof(DestinationID) == sizeof(DepotID));
    44 assert_compile(sizeof(DestinationID) == sizeof(DepotID));
    80 assert_compile(sizeof(DestinationID) == sizeof(WaypointID));
    45 assert_compile(sizeof(DestinationID) == sizeof(WaypointID));
    81 assert_compile(sizeof(DestinationID) == sizeof(StationID));
    46 assert_compile(sizeof(DestinationID) == sizeof(StationID));
    82 
    47 
    83 typedef int32 WindowNumber;
       
    84 
       
    85 enum {
       
    86 	INVALID_YEAR = -1,
       
    87 	INVALID_DATE = -1,
       
    88 };
       
    89 
       
    90 typedef int32 Year;
       
    91 typedef int32 Date;
       
    92 
       
    93 typedef uint32 PlayerFace; ///< player face bits, info see in player_face.h
    48 typedef uint32 PlayerFace; ///< player face bits, info see in player_face.h
       
    49 
       
    50 enum GameModes {
       
    51 	GM_MENU,
       
    52 	GM_NORMAL,
       
    53 	GM_EDITOR
       
    54 };
    94 
    55 
    95 enum SwitchModes {
    56 enum SwitchModes {
    96 	SM_NONE            =  0,
    57 	SM_NONE            =  0,
    97 	SM_NEWGAME         =  1,
    58 	SM_NEWGAME         =  1,
    98 	SM_EDITOR          =  2,
    59 	SM_EDITOR          =  2,
   166 /** Define basic enum properties */
   127 /** Define basic enum properties */
   167 template <> struct EnumPropsT<TransportType> : MakeEnumPropsT<TransportType, byte, TRANSPORT_BEGIN, TRANSPORT_END, INVALID_TRANSPORT> {};
   128 template <> struct EnumPropsT<TransportType> : MakeEnumPropsT<TransportType, byte, TRANSPORT_BEGIN, TRANSPORT_END, INVALID_TRANSPORT> {};
   168 typedef TinyEnumT<TransportType> TransportTypeByte;
   129 typedef TinyEnumT<TransportType> TransportTypeByte;
   169 
   130 
   170 
   131 
   171 struct TileInfo {
       
   172 	uint x;
       
   173 	uint y;
       
   174 	Slope tileh;
       
   175 	TileIndex tile;
       
   176 	uint z;
       
   177 };
       
   178 
       
   179 
       
   180 /* Display Options */
   132 /* Display Options */
   181 enum {
   133 enum {
   182 	DO_SHOW_TOWN_NAMES    = 0,
   134 	DO_SHOW_TOWN_NAMES    = 0,
   183 	DO_SHOW_STATION_NAMES = 1,
   135 	DO_SHOW_STATION_NAMES = 1,
   184 	DO_SHOW_SIGNS         = 2,
   136 	DO_SHOW_SIGNS         = 2,
   193 	LT_ARCTIC     = 1,
   145 	LT_ARCTIC     = 1,
   194 	LT_TROPIC     = 2,
   146 	LT_TROPIC     = 2,
   195 	LT_TOYLAND    = 3,
   147 	LT_TOYLAND    = 3,
   196 
   148 
   197 	NUM_LANDSCAPE = 4,
   149 	NUM_LANDSCAPE = 4,
   198 };
       
   199 
       
   200 /**
       
   201  * Town Layouts
       
   202  */
       
   203 enum TownLayout {
       
   204 	TL_NO_ROADS     = 0, ///< Build no more roads, but still build houses
       
   205 	TL_ORIGINAL,         ///< Original algorithm (min. 1 distance between roads)
       
   206 	TL_BETTER_ROADS,     ///< Extended original algorithm (min. 2 distance between roads)
       
   207 	TL_2X2_GRID,         ///< Geometric 2x2 grid algorithm
       
   208 	TL_3X3_GRID,         ///< Geometric 3x3 grid algorithm
       
   209 
       
   210 	NUM_TLS,             ///< Number of town layouts
       
   211 };
       
   212 
       
   213 /* It needs to be 8bits, because we save and load it as such */
       
   214 /** Define basic enum properties */
       
   215 template <> struct EnumPropsT<TownLayout> : MakeEnumPropsT<TownLayout, byte, TL_NO_ROADS, NUM_TLS, NUM_TLS> {};
       
   216 typedef TinyEnumT<TownLayout> TownLayoutByte; //typedefing-enumification of TownLayout
       
   217 
       
   218 enum {
       
   219 	NUM_PRICES = 49,
       
   220 };
       
   221 
       
   222 struct Prices {
       
   223 	Money station_value;
       
   224 	Money build_rail;
       
   225 	Money build_road;
       
   226 	Money build_signals;
       
   227 	Money build_bridge;
       
   228 	Money build_train_depot;
       
   229 	Money build_road_depot;
       
   230 	Money build_ship_depot;
       
   231 	Money build_tunnel;
       
   232 	Money train_station_track;
       
   233 	Money train_station_length;
       
   234 	Money build_airport;
       
   235 	Money build_bus_station;
       
   236 	Money build_truck_station;
       
   237 	Money build_dock;
       
   238 	Money build_railvehicle;
       
   239 	Money build_railwagon;
       
   240 	Money aircraft_base;
       
   241 	Money roadveh_base;
       
   242 	Money ship_base;
       
   243 	Money build_trees;
       
   244 	Money terraform;
       
   245 	Money clear_1;
       
   246 	Money purchase_land;
       
   247 	Money clear_2;
       
   248 	Money clear_3;
       
   249 	Money remove_trees;
       
   250 	Money remove_rail;
       
   251 	Money remove_signals;
       
   252 	Money clear_bridge;
       
   253 	Money remove_train_depot;
       
   254 	Money remove_road_depot;
       
   255 	Money remove_ship_depot;
       
   256 	Money clear_tunnel;
       
   257 	Money clear_water;
       
   258 	Money remove_rail_station;
       
   259 	Money remove_airport;
       
   260 	Money remove_bus_station;
       
   261 	Money remove_truck_station;
       
   262 	Money remove_dock;
       
   263 	Money remove_house;
       
   264 	Money remove_road;
       
   265 	Money running_rail[3];
       
   266 	Money aircraft_running;
       
   267 	Money roadveh_running;
       
   268 	Money ship_running;
       
   269 	Money build_industry;
       
   270 };
   150 };
   271 
   151 
   272 #define GAME_DIFFICULTY_NUM 18
   152 #define GAME_DIFFICULTY_NUM 18
   273 
   153 
   274 /** Specific type for Game Difficulty to ease changing the type */
   154 /** Specific type for Game Difficulty to ease changing the type */
   292 	GDType line_reverse_mode;
   172 	GDType line_reverse_mode;
   293 	GDType disasters;
   173 	GDType disasters;
   294 	GDType town_council_tolerance; // minimum required town ratings to be allowed to demolish stuff
   174 	GDType town_council_tolerance; // minimum required town ratings to be allowed to demolish stuff
   295 };
   175 };
   296 
   176 
   297 enum {
       
   298 	// Temperate
       
   299 	CT_PASSENGERS   =  0,
       
   300 	CT_COAL         =  1,
       
   301 	CT_MAIL         =  2,
       
   302 	CT_OIL          =  3,
       
   303 	CT_LIVESTOCK    =  4,
       
   304 	CT_GOODS        =  5,
       
   305 	CT_GRAIN        =  6,
       
   306 	CT_WOOD         =  7,
       
   307 	CT_IRON_ORE     =  8,
       
   308 	CT_STEEL        =  9,
       
   309 	CT_VALUABLES    = 10,
       
   310 
       
   311 	// Arctic
       
   312 	CT_WHEAT        =  6,
       
   313 	CT_HILLY_UNUSED =  8,
       
   314 	CT_PAPER        =  9,
       
   315 	CT_GOLD         = 10,
       
   316 	CT_FOOD         = 11,
       
   317 
       
   318 	// Tropic
       
   319 	CT_RUBBER       =  1,
       
   320 	CT_FRUIT        =  4,
       
   321 	CT_MAIZE        =  6,
       
   322 	CT_COPPER_ORE   =  8,
       
   323 	CT_WATER        =  9,
       
   324 	CT_DIAMONDS     = 10,
       
   325 
       
   326 	// Toyland
       
   327 	CT_SUGAR        =  1,
       
   328 	CT_TOYS         =  3,
       
   329 	CT_BATTERIES    =  4,
       
   330 	CT_CANDY        =  5,
       
   331 	CT_TOFFEE       =  6,
       
   332 	CT_COLA         =  7,
       
   333 	CT_COTTON_CANDY =  8,
       
   334 	CT_BUBBLES      =  9,
       
   335 	CT_PLASTIC      = 10,
       
   336 	CT_FIZZY_DRINKS = 11,
       
   337 
       
   338 	NUM_CARGO       = 32,
       
   339 
       
   340 	CT_NO_REFIT     = 0xFE,
       
   341 	CT_INVALID      = 0xFF
       
   342 };
       
   343 
       
   344 typedef uint AcceptedCargo[NUM_CARGO];
       
   345 
       
   346 struct TileDesc {
       
   347 	StringID str;
       
   348 	Owner owner;
       
   349 	Date build_date;
       
   350 	uint64 dparam[2];
       
   351 };
       
   352 
       
   353 struct ViewportSign {
   177 struct ViewportSign {
   354 	int32 left;
   178 	int32 left;
   355 	int32 top;
   179 	int32 top;
   356 	byte width_1, width_2;
   180 	byte width_1, width_2;
   357 };
   181 };
   358 
       
   359 /**
       
   360  * Common return value for all commands. Wraps the cost and
       
   361  * a possible error message/state together.
       
   362  */
       
   363 class CommandCost {
       
   364 	Money cost;       ///< The cost of this action
       
   365 	StringID message; ///< Warning message for when success is unset
       
   366 	bool success;     ///< Whether the comment went fine up to this moment
       
   367 
       
   368 public:
       
   369 	/**
       
   370 	 * Creates a command cost return with no cost and no error
       
   371 	 */
       
   372 	CommandCost() : cost(0), message(INVALID_STRING_ID), success(true) {}
       
   373 
       
   374 	/**
       
   375 	 * Creates a command return value the is failed with the given message
       
   376 	 */
       
   377 	CommandCost(StringID msg) : cost(0), message(msg), success(false) {}
       
   378 
       
   379 	/**
       
   380 	 * Creates a command return value with the given start cost
       
   381 	 * @param cst the initial cost of this command
       
   382 	 */
       
   383 	CommandCost(Money cst) : cost(cst), message(INVALID_STRING_ID), success(true) {}
       
   384 
       
   385 	/**
       
   386 	 * Adds the cost of the given command return value to this cost.
       
   387 	 * Also takes a possible error message when it is set.
       
   388 	 * @param ret the command to add the cost of.
       
   389 	 * @return this class.
       
   390 	 */
       
   391 	CommandCost AddCost(CommandCost ret);
       
   392 
       
   393 	/**
       
   394 	 * Adds the given cost to the cost of the command.
       
   395 	 * @param cost the cost to add
       
   396 	 * @return this class.
       
   397 	 */
       
   398 	CommandCost AddCost(Money cost);
       
   399 
       
   400 	/**
       
   401 	 * Multiplies the cost of the command by the given factor.
       
   402 	 * @param cost factor to multiply the costs with
       
   403 	 * @return this class
       
   404 	 */
       
   405 	CommandCost MultiplyCost(int factor);
       
   406 
       
   407 	/**
       
   408 	 * The costs as made up to this moment
       
   409 	 * @return the costs
       
   410 	 */
       
   411 	Money GetCost() const;
       
   412 
       
   413 	/**
       
   414 	 * Sets the global error message *if* this class has one.
       
   415 	 */
       
   416 	void SetGlobalErrorMessage() const;
       
   417 
       
   418 	/**
       
   419 	 * Did this command succeed?
       
   420 	 * @return true if and only if it succeeded
       
   421 	 */
       
   422 	bool Succeeded() const;
       
   423 
       
   424 	/**
       
   425 	 * Did this command fail?
       
   426 	 * @return true if and only if it failed
       
   427 	 */
       
   428 	bool Failed() const;
       
   429 };
       
   430 
       
   431 
       
   432 typedef void DrawTileProc(TileInfo *ti);
       
   433 typedef uint GetSlopeZProc(TileIndex tile, uint x, uint y);
       
   434 typedef CommandCost ClearTileProc(TileIndex tile, byte flags);
       
   435 typedef void GetAcceptedCargoProc(TileIndex tile, AcceptedCargo res);
       
   436 typedef void GetTileDescProc(TileIndex tile, TileDesc *td);
       
   437 /**
       
   438  * GetTileTrackStatusProcs return a value that contains the possible tracks
       
   439  * that can be taken on a given tile by a given transport. The return value is
       
   440  * composed as follows: 0xaabbccdd. ccdd and aabb are bitmasks of trackdirs,
       
   441  * where bit n corresponds to trackdir n. ccdd are the trackdirs that are
       
   442  * present in the tile (1==present, 0==not present), aabb is the signal
       
   443  * status, if applicable (0==green/no signal, 1==red, note that this is
       
   444  * reversed from map3/2[tile] for railway signals).
       
   445  *
       
   446  * The result (let's call it ts) is often used as follows:
       
   447  * tracks = (byte)(ts | ts >>8)
       
   448  * This effectively converts the present part of the result (ccdd) to a
       
   449  * track bitmask, which disregards directions. Normally, this is the same as just
       
   450  * doing (byte)ts I think, although I am not really sure
       
   451  *
       
   452  * A trackdir is combination of a track and a dir, where the lower three bits
       
   453  * are a track, the fourth bit is the direction. these give 12 (or 14)
       
   454  * possible options: 0-5 and 8-13, so we need 14 bits for a trackdir bitmask
       
   455  * above.
       
   456  * @param tile     the tile to get the track status from
       
   457  * @param mode     the mode of transportation
       
   458  * @param sub_mode used to differentiate between different kinds within the mode
       
   459  * @return the above mentions track status information
       
   460  */
       
   461 typedef uint32 GetTileTrackStatusProc(TileIndex tile, TransportType mode, uint sub_mode);
       
   462 typedef void GetProducedCargoProc(TileIndex tile, CargoID *b);
       
   463 typedef void ClickTileProc(TileIndex tile);
       
   464 typedef void AnimateTileProc(TileIndex tile);
       
   465 typedef void TileLoopProc(TileIndex tile);
       
   466 typedef void ChangeTileOwnerProc(TileIndex tile, PlayerID old_player, PlayerID new_player);
       
   467 /** @see VehicleEnterTileStatus to see what the return values mean */
       
   468 typedef uint32 VehicleEnterTileProc(Vehicle *v, TileIndex tile, int x, int y);
       
   469 typedef Foundation GetFoundationProc(TileIndex tile, Slope tileh);
       
   470 /**
       
   471  * Called when a tile is affected by a terraforming operation.
       
   472  * The function has to check if terraforming of the tile is allowed and return extra terraform-cost that depend on the tiletype.
       
   473  * With DC_EXEC in flags it has to perform tiletype-specific actions (like clearing land etc., but not the terraforming itself).
       
   474  *
       
   475  * @note The terraforming has not yet taken place. So GetTileZ() and GetTileSlope() refer to the landscape before the terraforming operation.
       
   476  *
       
   477  * @param tile      The involved tile.
       
   478  * @param flags     Command flags passed to the terraform command (DC_EXEC, DC_QUERY_COST, etc.).
       
   479  * @param z_new     TileZ after terraforming.
       
   480  * @param tileh_new Slope after terraforming.
       
   481  * @return Error code or extra cost for terraforming (like clearing land, building foundations, etc., but not the terraforming itself.)
       
   482  */
       
   483 typedef CommandCost TerraformTileProc(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new);
       
   484 
       
   485 struct TileTypeProcs {
       
   486 	DrawTileProc *draw_tile_proc;
       
   487 	GetSlopeZProc *get_slope_z_proc;
       
   488 	ClearTileProc *clear_tile_proc;
       
   489 	GetAcceptedCargoProc *get_accepted_cargo_proc;
       
   490 	GetTileDescProc *get_tile_desc_proc;
       
   491 	GetTileTrackStatusProc *get_tile_track_status_proc;
       
   492 	ClickTileProc *click_tile_proc;
       
   493 	AnimateTileProc *animate_tile_proc;
       
   494 	TileLoopProc *tile_loop_proc;
       
   495 	ChangeTileOwnerProc *change_tile_owner_proc;
       
   496 	GetProducedCargoProc *get_produced_cargo_proc;
       
   497 	VehicleEnterTileProc *vehicle_enter_tile_proc;
       
   498 	GetFoundationProc *get_foundation_proc;
       
   499 	TerraformTileProc *terraform_tile_proc;
       
   500 };
       
   501 
       
   502 
       
   503 enum WindowClass {
       
   504 	WC_NONE,
       
   505 	WC_MAIN_WINDOW = WC_NONE,
       
   506 	WC_MAIN_TOOLBAR,
       
   507 	WC_STATUS_BAR,
       
   508 	WC_BUILD_TOOLBAR,
       
   509 	WC_NEWS_WINDOW,
       
   510 	WC_TOWN_DIRECTORY,
       
   511 	WC_STATION_LIST,
       
   512 	WC_TOWN_VIEW,
       
   513 	WC_SMALLMAP,
       
   514 	WC_TRAINS_LIST,
       
   515 	WC_ROADVEH_LIST,
       
   516 	WC_SHIPS_LIST,
       
   517 	WC_AIRCRAFT_LIST,
       
   518 	WC_VEHICLE_VIEW,
       
   519 	WC_VEHICLE_DETAILS,
       
   520 	WC_VEHICLE_REFIT,
       
   521 	WC_VEHICLE_ORDERS,
       
   522 	WC_STATION_VIEW,
       
   523 	WC_VEHICLE_DEPOT,
       
   524 	WC_BUILD_VEHICLE,
       
   525 	WC_BUILD_BRIDGE,
       
   526 	WC_ERRMSG,
       
   527 	WC_BUILD_STATION,
       
   528 	WC_BUS_STATION,
       
   529 	WC_TRUCK_STATION,
       
   530 	WC_BUILD_DEPOT,
       
   531 	WC_COMPANY,
       
   532 	WC_FINANCES,
       
   533 	WC_PLAYER_COLOR,
       
   534 	WC_QUERY_STRING,
       
   535 	WC_SAVELOAD,
       
   536 	WC_SELECT_GAME,
       
   537 	WC_TOOLBAR_MENU,
       
   538 	WC_INCOME_GRAPH,
       
   539 	WC_OPERATING_PROFIT,
       
   540 	WC_TOOLTIPS,
       
   541 	WC_INDUSTRY_VIEW,
       
   542 	WC_PLAYER_FACE,
       
   543 	WC_LAND_INFO,
       
   544 	WC_TOWN_AUTHORITY,
       
   545 	WC_SUBSIDIES_LIST,
       
   546 	WC_GRAPH_LEGEND,
       
   547 	WC_DELIVERED_CARGO,
       
   548 	WC_PERFORMANCE_HISTORY,
       
   549 	WC_COMPANY_VALUE,
       
   550 	WC_COMPANY_LEAGUE,
       
   551 	WC_BUY_COMPANY,
       
   552 	WC_PAYMENT_RATES,
       
   553 	WC_ENGINE_PREVIEW,
       
   554 	WC_MUSIC_WINDOW,
       
   555 	WC_MUSIC_TRACK_SELECTION,
       
   556 	WC_SCEN_LAND_GEN,
       
   557 	WC_SCEN_TOWN_GEN,
       
   558 	WC_SCEN_INDUSTRY,
       
   559 	WC_SCEN_BUILD_ROAD,
       
   560 	WC_BUILD_TREES,
       
   561 	WC_SEND_NETWORK_MSG,
       
   562 	WC_DROPDOWN_MENU,
       
   563 	WC_BUILD_INDUSTRY,
       
   564 	WC_GAME_OPTIONS,
       
   565 	WC_NETWORK_WINDOW,
       
   566 	WC_INDUSTRY_DIRECTORY,
       
   567 	WC_MESSAGE_HISTORY,
       
   568 	WC_CHEATS,
       
   569 	WC_PERFORMANCE_DETAIL,
       
   570 	WC_CONSOLE,
       
   571 	WC_EXTRA_VIEW_PORT,
       
   572 	WC_CLIENT_LIST,
       
   573 	WC_NETWORK_STATUS_WINDOW,
       
   574 	WC_CUSTOM_CURRENCY,
       
   575 	WC_REPLACE_VEHICLE,
       
   576 	WC_HIGHSCORE,
       
   577 	WC_ENDSCREEN,
       
   578 	WC_SIGN_LIST,
       
   579 	WC_GENERATE_LANDSCAPE,
       
   580 	WC_GENERATE_PROGRESS_WINDOW,
       
   581 	WC_CONFIRM_POPUP_QUERY,
       
   582 	WC_TRANSPARENCY_TOOLBAR,
       
   583 	WC_VEHICLE_TIMETABLE,
       
   584 };
       
   585 
       
   586 
       
   587 enum ExpensesType {
       
   588 	EXPENSES_CONSTRUCTION =  0,
       
   589 	EXPENSES_NEW_VEHICLES =  1,
       
   590 	EXPENSES_TRAIN_RUN    =  2,
       
   591 	EXPENSES_ROADVEH_RUN  =  3,
       
   592 	EXPENSES_AIRCRAFT_RUN =  4,
       
   593 	EXPENSES_SHIP_RUN     =  5,
       
   594 	EXPENSES_PROPERTY     =  6,
       
   595 	EXPENSES_TRAIN_INC    =  7,
       
   596 	EXPENSES_ROADVEH_INC  =  8,
       
   597 	EXPENSES_AIRCRAFT_INC =  9,
       
   598 	EXPENSES_SHIP_INC     = 10,
       
   599 	EXPENSES_LOAN_INT     = 11,
       
   600 	EXPENSES_OTHER        = 12,
       
   601 };
       
   602 
       
   603 enum {
       
   604 	MAX_LANG = 64,
       
   605 };
       
   606 
       
   607 // special string constants
       
   608 enum SpecialStrings {
       
   609 
       
   610 	// special strings for town names. the town name is generated dynamically on request.
       
   611 	SPECSTR_TOWNNAME_START     = 0x20C0,
       
   612 	SPECSTR_TOWNNAME_ENGLISH   = SPECSTR_TOWNNAME_START,
       
   613 	SPECSTR_TOWNNAME_FRENCH,
       
   614 	SPECSTR_TOWNNAME_GERMAN,
       
   615 	SPECSTR_TOWNNAME_AMERICAN,
       
   616 	SPECSTR_TOWNNAME_LATIN,
       
   617 	SPECSTR_TOWNNAME_SILLY,
       
   618 	SPECSTR_TOWNNAME_SWEDISH,
       
   619 	SPECSTR_TOWNNAME_DUTCH,
       
   620 	SPECSTR_TOWNNAME_FINNISH,
       
   621 	SPECSTR_TOWNNAME_POLISH,
       
   622 	SPECSTR_TOWNNAME_SLOVAKISH,
       
   623 	SPECSTR_TOWNNAME_NORWEGIAN,
       
   624 	SPECSTR_TOWNNAME_HUNGARIAN,
       
   625 	SPECSTR_TOWNNAME_AUSTRIAN,
       
   626 	SPECSTR_TOWNNAME_ROMANIAN,
       
   627 	SPECSTR_TOWNNAME_CZECH,
       
   628 	SPECSTR_TOWNNAME_SWISS,
       
   629 	SPECSTR_TOWNNAME_DANISH,
       
   630 	SPECSTR_TOWNNAME_TURKISH,
       
   631 	SPECSTR_TOWNNAME_ITALIAN,
       
   632 	SPECSTR_TOWNNAME_CATALAN,
       
   633 	SPECSTR_TOWNNAME_LAST      = SPECSTR_TOWNNAME_CATALAN,
       
   634 
       
   635 	// special strings for player names on the form "TownName transport".
       
   636 	SPECSTR_PLAYERNAME_START   = 0x70EA,
       
   637 	SPECSTR_PLAYERNAME_ENGLISH = SPECSTR_PLAYERNAME_START,
       
   638 	SPECSTR_PLAYERNAME_FRENCH,
       
   639 	SPECSTR_PLAYERNAME_GERMAN,
       
   640 	SPECSTR_PLAYERNAME_AMERICAN,
       
   641 	SPECSTR_PLAYERNAME_LATIN,
       
   642 	SPECSTR_PLAYERNAME_SILLY,
       
   643 	SPECSTR_PLAYERNAME_LAST    = SPECSTR_PLAYERNAME_SILLY,
       
   644 
       
   645 	SPECSTR_ANDCO_NAME         = 0x70E6,
       
   646 	SPECSTR_PRESIDENT_NAME     = 0x70E7,
       
   647 	SPECSTR_SONGNAME           = 0x70E8,
       
   648 
       
   649 	// reserve MAX_LANG strings for the *.lng files
       
   650 	SPECSTR_LANGUAGE_START     = 0x7100,
       
   651 	SPECSTR_LANGUAGE_END       = SPECSTR_LANGUAGE_START + MAX_LANG - 1,
       
   652 
       
   653 	// reserve 32 strings for various screen resolutions
       
   654 	SPECSTR_RESOLUTION_START   = SPECSTR_LANGUAGE_END + 1,
       
   655 	SPECSTR_RESOLUTION_END     = SPECSTR_RESOLUTION_START + 0x1F,
       
   656 
       
   657 	// reserve 32 strings for screenshot formats
       
   658 	SPECSTR_SCREENSHOT_START   = SPECSTR_RESOLUTION_END + 1,
       
   659 	SPECSTR_SCREENSHOT_END     = SPECSTR_SCREENSHOT_START + 0x1F,
       
   660 
       
   661 	// Used to implement SetDParamStr
       
   662 	STR_SPEC_DYNSTRING         = 0xF800,
       
   663 	STR_SPEC_USERSTRING        = 0xF808,
       
   664 };
       
   665 
       
   666 typedef void PlaceProc(TileIndex tile);
       
   667 
   182 
   668 enum {
   183 enum {
   669 	SORT_ASCENDING  = 0,
   184 	SORT_ASCENDING  = 0,
   670 	SORT_DESCENDING = 1,
   185 	SORT_DESCENDING = 1,
   671 	SORT_BY_DATE    = 0,
   186 	SORT_BY_DATE    = 0,
   699 	MSG_OTTD_SAVETHREAD_ERROR,
   214 	MSG_OTTD_SAVETHREAD_ERROR,
   700 };
   215 };
   701 
   216 
   702 void OTTD_SendThreadMessage(ThreadMsg msg);
   217 void OTTD_SendThreadMessage(ThreadMsg msg);
   703 
   218 
       
   219 extern byte _game_mode;
       
   220 extern bool _exit_game;
       
   221 extern byte _pause_game;
       
   222 
   704 #endif /* OPENTTD_H */
   223 #endif /* OPENTTD_H */