truelight@0: #ifndef TTD_H truelight@0: #define TTD_H truelight@0: truelight@0: // include strings truelight@0: #include "table/strings.h" truelight@0: truelight@0: #ifndef VARDEF truelight@0: #define VARDEF extern truelight@0: #endif truelight@0: truelight@0: // use this on non static functions truelight@0: #define PUBLIC truelight@0: truelight@0: typedef struct Rect { truelight@0: int left,top,right,bottom; truelight@0: } Rect; truelight@0: truelight@0: typedef struct SmallPoint { truelight@0: int16 x,y; truelight@0: } SmallPoint; truelight@0: truelight@0: typedef struct Point { truelight@0: int x,y; truelight@0: } Point; truelight@0: truelight@0: typedef struct Pair { truelight@0: int a; truelight@0: int b; truelight@0: } Pair; truelight@0: truelight@0: typedef struct YearMonthDay { truelight@0: int year, month, day; truelight@0: } YearMonthDay; truelight@0: truelight@0: #include "macros.h" truelight@0: truelight@0: // Forward declarations of structs. truelight@0: typedef struct Vehicle Vehicle; truelight@0: typedef struct Depot Depot; truelight@0: typedef struct Checkpoint Checkpoint; truelight@0: typedef struct Window Window; truelight@0: typedef struct Station Station; truelight@0: typedef struct ViewPort ViewPort; truelight@0: typedef struct Town Town; truelight@0: typedef struct NewsItem NewsItem; truelight@0: typedef struct Industry Industry; truelight@0: typedef struct DrawPixelInfo DrawPixelInfo; truelight@0: typedef uint16 VehicleID; truelight@0: typedef uint16 StringID; truelight@0: typedef uint16 SpriteID; truelight@0: typedef uint32 PalSpriteID; truelight@0: truelight@0: typedef uint32 WindowNumber; truelight@0: typedef byte WindowClass; truelight@0: truelight@0: truelight@0: enum GameModes { truelight@0: GM_MENU, truelight@0: GM_NORMAL, truelight@0: GM_EDITOR truelight@0: }; truelight@0: truelight@0: enum SwitchModes { truelight@0: SM_NONE = 0, truelight@0: SM_NEWGAME = 1, truelight@0: SM_EDITOR = 2, truelight@0: SM_LOAD = 3, truelight@0: SM_MENU = 4, truelight@0: SM_SAVE = 5, truelight@0: SM_GENRANDLAND = 6, truelight@0: SM_LOAD_SCENARIO = 9, truelight@0: truelight@0: }; truelight@0: truelight@0: enum MapTileTypes { truelight@0: MP_CLEAR, truelight@0: MP_RAILWAY, truelight@0: MP_STREET, truelight@0: MP_HOUSE, truelight@0: MP_TREES, truelight@0: MP_STATION, truelight@0: MP_WATER, truelight@0: MP_STRANGE, truelight@0: MP_INDUSTRY, truelight@0: MP_TUNNELBRIDGE, truelight@0: MP_UNMOVABLE truelight@0: }; truelight@0: truelight@0: typedef struct TileInfo { truelight@0: uint x; truelight@0: uint y; truelight@0: uint tileh; truelight@0: uint type; truelight@0: uint map5; truelight@0: uint tile; truelight@0: uint z; truelight@0: } TileInfo; truelight@0: truelight@0: enum { truelight@0: NG_EDGE = 1, truelight@0: }; truelight@0: truelight@0: /* Display Options */ truelight@0: enum { truelight@0: DO_SHOW_TOWN_NAMES = 1, truelight@0: DO_SHOW_STATION_NAMES = 2, truelight@0: DO_SHOW_SIGNS = 4, truelight@0: DO_FULL_ANIMATION = 8, truelight@0: DO_TRANS_BUILDINGS = 0x10, truelight@0: DO_FULL_DETAIL = 0x20, truelight@0: DO_CHECKPOINTS = 0x40, truelight@0: }; truelight@0: truelight@0: /* Landscape types */ truelight@0: enum { truelight@0: LT_NORMAL = 0, truelight@0: LT_HILLY = 1, truelight@0: LT_DESERT = 2, truelight@0: LT_CANDY = 3, truelight@0: truelight@0: NUM_LANDSCAPE = 4, truelight@0: }; truelight@0: truelight@0: enum { truelight@0: NUM_PRICES = 49, truelight@0: }; truelight@0: truelight@0: typedef struct Prices { truelight@0: int32 station_value; truelight@0: int32 build_rail; truelight@0: int32 build_road; truelight@0: int32 build_signals; truelight@0: int32 build_bridge; truelight@0: int32 build_train_depot; truelight@0: int32 build_road_depot; truelight@0: int32 build_ship_depot; truelight@0: int32 build_tunnel; truelight@0: int32 train_station_track; truelight@0: int32 train_station_length; truelight@0: int32 build_airport; truelight@0: int32 build_bus_station; truelight@0: int32 build_truck_station; truelight@0: int32 build_dock; truelight@0: int32 build_railvehicle; truelight@0: int32 build_railwagon; truelight@0: int32 aircraft_base; truelight@0: int32 roadveh_base; truelight@0: int32 ship_base; truelight@0: int32 build_trees; truelight@0: int32 terraform; truelight@0: int32 clear_1; truelight@0: int32 purchase_land; truelight@0: int32 clear_2; truelight@0: int32 clear_3; truelight@0: int32 remove_trees; truelight@0: int32 remove_rail; truelight@0: int32 remove_signals; truelight@0: int32 clear_bridge; truelight@0: int32 remove_train_depot; truelight@0: int32 remove_road_depot; truelight@0: int32 remove_ship_depot; truelight@0: int32 clear_tunnel; truelight@0: int32 clear_water; truelight@0: int32 remove_rail_station; truelight@0: int32 remove_airport; truelight@0: int32 remove_bus_station; truelight@0: int32 remove_truck_station; truelight@0: int32 remove_dock; truelight@0: int32 remove_house; truelight@0: int32 remove_road; truelight@0: int32 running_rail[3]; truelight@0: int32 aircraft_running; truelight@0: int32 roadveh_running; truelight@0: int32 ship_running; truelight@0: int32 build_industry; truelight@0: } Prices; truelight@0: truelight@0: #define GAME_DIFFICULTY_NUM 18 truelight@0: truelight@0: typedef struct GameDifficulty { truelight@0: int max_no_competitors; truelight@0: int competitor_start_time; truelight@0: int number_towns; truelight@0: int number_industries; truelight@0: int max_loan; truelight@0: int initial_interest; truelight@0: int vehicle_costs; truelight@0: int competitor_speed; truelight@0: int competitor_intelligence; truelight@0: int vehicle_breakdowns; truelight@0: int subsidy_multiplier; truelight@0: int construction_cost; truelight@0: int terrain_type; truelight@0: int quantity_sea_lakes; truelight@0: int economy; truelight@0: int line_reverse_mode; truelight@0: int disasters; truelight@0: int town_council_tolerance; // minimum required town ratings to be allowed to demolish stuff truelight@0: } GameDifficulty; truelight@0: truelight@0: typedef struct AcceptedCargo { truelight@0: int type_1, amount_1; truelight@0: int type_2, amount_2; truelight@0: int type_3, amount_3; truelight@0: } AcceptedCargo; truelight@0: truelight@0: typedef struct TileDesc { truelight@0: StringID str; truelight@0: byte owner; truelight@71: uint16 build_date; truelight@0: uint32 dparam[2]; truelight@0: } TileDesc; truelight@0: truelight@0: typedef struct { truelight@0: int16 left, top; truelight@0: byte width_1, width_2; truelight@0: } ViewportSign; truelight@0: truelight@0: typedef struct SignStruct { truelight@0: StringID str; truelight@0: ViewportSign sign; truelight@0: int16 x,y; truelight@0: byte z; truelight@0: } SignStruct; truelight@0: truelight@0: truelight@0: typedef int32 CommandProc(int x, int y, uint32 flags, uint32 p1, uint32 p2); truelight@0: truelight@0: typedef void DrawTileProc(TileInfo *ti); truelight@0: typedef uint GetSlopeZProc(TileInfo *ti); truelight@0: typedef int32 ClearTileProc(uint tile, byte flags); truelight@0: typedef void GetAcceptedCargoProc(uint tile, AcceptedCargo *res); truelight@0: typedef void GetTileDescProc(uint tile, TileDesc *td); truelight@0: typedef uint32 GetTileTrackStatusProc(uint tile, int mode); truelight@0: typedef void GetProducedCargoProc(uint tile, byte *b); truelight@0: typedef void ClickTileProc(uint tile); truelight@0: typedef void AnimateTileProc(uint tile); truelight@0: typedef void TileLoopProc(uint tile); truelight@0: typedef void ChangeTileOwnerProc(uint tile, byte old_player, byte new_player); darkvater@22: /* Return value has bit 0x2 set, when the vehicle enters a station. Then, darkvater@22: * result << 8 contains the id of the station entered. If the return value has darkvater@22: * bit 0x8 set, the vehicle could not and did not enter the tile. Are there darkvater@22: * other bits that can be set? */ truelight@0: typedef uint32 VehicleEnterTileProc(Vehicle *v, uint tile, int x, int y); truelight@0: typedef void VehicleLeaveTileProc(Vehicle *v, uint tile, int x, int y); dominik@39: typedef uint GetSlopeTilehProc(TileInfo *ti); truelight@0: truelight@0: typedef struct { truelight@0: DrawTileProc *draw_tile_proc; truelight@0: GetSlopeZProc *get_slope_z_proc; truelight@0: ClearTileProc *clear_tile_proc; truelight@0: GetAcceptedCargoProc *get_accepted_cargo_proc; truelight@0: GetTileDescProc *get_tile_desc_proc; truelight@0: GetTileTrackStatusProc *get_tile_track_status_proc; truelight@0: ClickTileProc *click_tile_proc; truelight@0: AnimateTileProc *animate_tile_proc; truelight@0: TileLoopProc *tile_loop_proc; truelight@0: ChangeTileOwnerProc *change_tile_owner_proc; truelight@0: GetProducedCargoProc *get_produced_cargo_proc; truelight@0: VehicleEnterTileProc *vehicle_enter_tile_proc; truelight@0: VehicleLeaveTileProc *vehicle_leave_tile_proc; dominik@39: GetSlopeTilehProc *get_slope_tileh_proc; truelight@0: } TileTypeProcs; truelight@0: truelight@0: truelight@0: truelight@0: #define MP_SETTYPE(x) ((x+1) << 8) truelight@0: truelight@0: enum { truelight@0: MP_MAP2 = 1<<0, truelight@0: MP_MAP3LO = 1<<1, truelight@0: MP_MAP3HI = 1<<2, truelight@0: MP_MAP5 = 1<<3, truelight@0: MP_MAPOWNER_CURRENT = 1<<4, truelight@0: MP_MAPOWNER = 1<<5, truelight@0: truelight@0: MP_TYPE_MASK = 0xF << 8, truelight@0: truelight@0: MP_MAP2_CLEAR = 1 << 12, truelight@0: MP_MAP3LO_CLEAR = 1 << 13, truelight@0: MP_MAP3HI_CLEAR = 1 << 14, truelight@0: truelight@0: MP_NODIRTY = 1<<15, truelight@0: }; truelight@0: truelight@0: enum { truelight@0: // Temperate truelight@0: CT_PASSENGERS = 0, truelight@0: CT_COAL = 1, truelight@0: CT_MAIL = 2, truelight@0: CT_OIL = 3, truelight@0: CT_LIVESTOCK = 4, truelight@0: CT_GOODS = 5, truelight@0: CT_GRAIN = 6, truelight@0: CT_WOOD = 7, truelight@0: CT_IRON_ORE = 8, truelight@0: CT_STEEL = 9, truelight@0: CT_VALUABLES = 10, truelight@0: CT_FOOD = 11, truelight@0: truelight@0: // Arctic truelight@0: CT_HILLY_UNUSED = 8, truelight@0: CT_PAPER = 9, truelight@0: truelight@0: // Tropic truelight@0: CT_RUBBER = 1, truelight@0: CT_FRUIT = 4, truelight@0: CT_COPPER_ORE = 8, truelight@0: CT_WATER = 9, truelight@0: truelight@0: // Toyland truelight@0: CT_SUGAR = 1, truelight@0: CT_TOYS = 3, truelight@0: CT_BATTERIES = 4, truelight@0: CT_CANDY = 5, truelight@0: CT_TOFFEE = 6, truelight@0: CT_COLA = 7, truelight@0: CT_COTTON_CANDY = 8, truelight@0: CT_BUBBLES = 9, truelight@0: CT_PLASTIC = 10, truelight@0: CT_FIZZY_DRINKS = 11, truelight@0: truelight@0: NUM_CARGO = 12, truelight@0: }; truelight@0: truelight@0: enum { truelight@0: WC_MAIN_WINDOW = 0x0, truelight@0: WC_MAIN_TOOLBAR = 0x1, truelight@0: WC_STATUS_BAR = 0x2, truelight@0: WC_BUILD_TOOLBAR = 0x3, truelight@0: WC_NEWS_WINDOW = 0x4, truelight@0: WC_TOWN_DIRECTORY = 0x5, truelight@0: WC_STATION_LIST = 0x6, truelight@0: WC_TOWN_VIEW = 0x7, truelight@0: WC_SMALLMAP = 0x8, truelight@0: WC_TRAINS_LIST = 0x9, truelight@0: WC_ROADVEH_LIST = 0xA, truelight@0: WC_SHIPS_LIST = 0xB, truelight@0: WC_AIRCRAFT_LIST = 0xC, truelight@0: WC_VEHICLE_VIEW = 0xD, truelight@0: WC_VEHICLE_DETAILS = 0xE, truelight@0: WC_VEHICLE_REFIT = 0xF, truelight@0: WC_VEHICLE_ORDERS = 0x10, truelight@0: WC_STATION_VIEW = 0x11, truelight@0: WC_VEHICLE_DEPOT = 0x12, truelight@0: WC_BUILD_VEHICLE = 0x13, truelight@0: WC_BUILD_BRIDGE = 0x14, truelight@0: WC_ERRMSG = 0x15, truelight@0: WC_ASK_ABANDON_GAME = 0x16, truelight@0: WC_QUIT_GAME = 0x17, truelight@0: WC_BUILD_STATION = 0x18, truelight@0: WC_BUS_STATION = 0x19, truelight@0: WC_TRUCK_STATION = 0x1A, truelight@0: WC_BUILD_DEPOT = 0x1B, truelight@0: WC_DEBUGGER = 0x1C, truelight@0: WC_COMPANY = 0x1D, truelight@0: WC_FINANCES = 0x1E, truelight@0: WC_PLAYER_COLOR = 0x1F, truelight@0: WC_QUERY_STRING = 0x20, truelight@0: WC_SAVELOAD = 0x21, truelight@0: WC_SELECT_GAME = 0x22, truelight@0: WC_TOOLBAR_MENU = 0x24, truelight@0: WC_INCOME_GRAPH = 0x25, truelight@0: WC_OPERATING_PROFIT = 0x26, truelight@0: WC_TOOLTIPS = 0x27, truelight@0: WC_INDUSTRY_VIEW = 0x28, truelight@0: WC_PLAYER_FACE = 0x29, truelight@0: WC_LAND_INFO = 0x2A, truelight@0: WC_TOWN_AUTHORITY = 0x2B, truelight@0: WC_SUBSIDIES_LIST = 0x2C, truelight@0: WC_GRAPH_LEGEND = 0x2D, truelight@0: WC_DELIVERED_CARGO = 0x2E, truelight@0: WC_PERFORMANCE_HISTORY = 0x2F, truelight@0: WC_COMPANY_VALUE = 0x30, truelight@0: WC_COMPANY_LEAGUE = 0x31, truelight@0: WC_BUY_COMPANY = 0x32, truelight@0: WC_PAYMENT_RATES = 0x33, truelight@0: WC_SELECT_TUTORIAL = 0x34, truelight@0: WC_ENGINE_PREVIEW = 0x35, truelight@0: WC_MUSIC_WINDOW = 0x36, truelight@0: WC_MUSIC_TRACK_SELECTION = 0x37, truelight@0: WC_SCEN_LAND_GEN = 0x38, truelight@0: WC_ASK_RESET_LANDSCAPE = 0x39, truelight@0: WC_SCEN_TOWN_GEN = 0x3A, truelight@0: WC_SCEN_INDUSTRY = 0x3B, truelight@0: WC_SCEN_BUILD_ROAD = 0x3C, truelight@0: WC_SCEN_BUILD_TREES = 0x3D, truelight@0: WC_SEND_NETWORK_MSG = 0x3E, truelight@0: WC_DROPDOWN_MENU = 0x3F, truelight@0: WC_BUILD_INDUSTRY = 0x40, truelight@0: WC_GAME_OPTIONS = 0x41, truelight@0: WC_NETWORK_WINDOW = 0x42, truelight@0: WC_INDUSTRY_DIRECTORY = 0x43, truelight@0: WC_MESSAGE_HISTORY = 0x44, truelight@0: WC_CHEATS = 0x45, truelight@0: }; truelight@0: truelight@0: truelight@0: enum { truelight@0: EXPENSES_CONSTRUCTION = 0, truelight@0: EXPENSES_NEW_VEHICLES = 1, truelight@0: EXPENSES_TRAIN_RUN = 2, truelight@0: EXPENSES_ROADVEH_RUN = 3, truelight@0: EXPENSES_AIRCRAFT_RUN = 4, truelight@0: EXPENSES_SHIP_RUN = 5, truelight@0: EXPENSES_PROPERTY = 6, truelight@0: EXPENSES_TRAIN_INC = 7, truelight@0: EXPENSES_ROADVEH_INC = 8, truelight@0: EXPENSES_AIRCRAFT_INC = 9, truelight@0: EXPENSES_SHIP_INC = 10, truelight@0: EXPENSES_LOAN_INT = 11, truelight@0: EXPENSES_OTHER = 12, truelight@0: }; truelight@0: truelight@0: // Tile type misc constants, don't know where to put these truelight@0: enum { truelight@0: TRACKTYPE_SPRITE_PITCH = 0x52, truelight@0: }; truelight@0: truelight@0: truelight@0: // special string constants truelight@0: enum SpecialStrings { truelight@0: truelight@0: // special strings for town names. the town name is generated dynamically on request. truelight@0: SPECSTR_TOWNNAME_START = 0x20C0, truelight@0: SPECSTR_TOWNNAME_ENGLISH = SPECSTR_TOWNNAME_START, truelight@0: SPECSTR_TOWNNAME_FRENCH, truelight@0: SPECSTR_TOWNNAME_GERMAN, truelight@0: SPECSTR_TOWNNAME_AMERICAN, truelight@0: SPECSTR_TOWNNAME_LATIN, truelight@0: SPECSTR_TOWNNAME_SILLY, truelight@0: SPECSTR_TOWNNAME_SWEDISH, truelight@0: SPECSTR_TOWNNAME_DUTCH, truelight@0: SPECSTR_TOWNNAME_FINNISH, truelight@0: SPECSTR_TOWNNAME_POLISH, truelight@0: SPECSTR_TOWNNAME_SLOVAKISH, truelight@0: SPECSTR_TOWNNAME_HUNGARIAN, truelight@0: SPECSTR_TOWNNAME_AUSTRIAN, truelight@0: SPECSTR_TOWNNAME_LAST = SPECSTR_TOWNNAME_AUSTRIAN, truelight@0: truelight@0: // special strings for player names on the form "TownName transport". truelight@0: SPECSTR_PLAYERNAME_START = 0x70EA, truelight@0: SPECSTR_PLAYERNAME_ENGLISH = SPECSTR_PLAYERNAME_START, truelight@0: SPECSTR_PLAYERNAME_FRENCH, truelight@0: SPECSTR_PLAYERNAME_GERMAN, truelight@0: SPECSTR_PLAYERNAME_AMERICAN, truelight@0: SPECSTR_PLAYERNAME_LATIN, truelight@0: SPECSTR_PLAYERNAME_SILLY, truelight@0: SPECSTR_PLAYERNAME_LAST = SPECSTR_PLAYERNAME_SILLY, truelight@0: truelight@0: SPECSTR_ANDCO_NAME = 0x70E6, truelight@0: SPECSTR_PRESIDENT_NAME = 0x70E7, truelight@0: SPECSTR_SONGNAME = 0x70E8, truelight@0: truelight@0: // reserve 32 strings for the *.lng files truelight@0: SPECSTR_LANGUAGE_START = 0x7100, truelight@0: SPECSTR_LANGUAGE_END = 0x711f, truelight@0: truelight@0: // reserve 32 strings for various screen resolutions truelight@0: SPECSTR_RESOLUTION_START = 0x7120, truelight@0: SPECSTR_RESOLUTION_END = 0x713f, truelight@0: truelight@0: // reserve 32 strings for screenshot formats truelight@0: SPECSTR_SCREENSHOT_START = 0x7140, truelight@0: SPECSTR_SCREENSHOT_END = 0x715F, truelight@0: truelight@0: STR_SPEC_SCREENSHOT_NAME = 0xF800, truelight@0: STR_SPEC_USERSTRING = 0xF801, truelight@0: }; truelight@0: truelight@0: typedef void PlaceProc(uint tile); truelight@0: truelight@0: enum Sprites { dominik@37: SPR_CANALS_BASE = 0x1406, dominik@37: SPR_SLOPES_BASE = SPR_CANALS_BASE + 70, dominik@37: SPR_OPENTTD_BASE = SPR_SLOPES_BASE + 74, truelight@0: }; truelight@0: truelight@0: enum MAP_OWNERS { darkvater@1: OWNER_TOWN = 0xf, // a town owns the tile darkvater@1: OWNER_NONE = 0x10,// nobody owns the tile darkvater@1: OWNER_WATER = 0x11,// "water" owns the tile darkvater@1: OWNER_SPECTATOR = 0xff, // spectator in MP or in scenario editor truelight@0: }; truelight@0: truelight@0: VARDEF bool _savegame_sort_dirty; truelight@0: VARDEF byte _savegame_sort_order; truelight@0: truelight@0: #define INVALID_UINT_TILE (uint)0xFFFFFFFF truelight@0: #define INVALID_STRING_ID 0xFFFF truelight@0: truelight@0: enum { truelight@0: MAX_SCREEN_WIDTH = 2048, truelight@0: MAX_SCREEN_HEIGHT = 1200, truelight@0: }; truelight@0: truelight@0: #include "functions.h" truelight@0: #include "variables.h" truelight@0: truelight@0: #endif /* TTD_H */