src/openttd.h
changeset 8615 6b91ca653bad
parent 8612 6414fc21c2f3
child 8617 931e0970d509
equal deleted inserted replaced
8614:21126f54f5c8 8615:6b91ca653bad
    26 	int b;
    26 	int b;
    27 };
    27 };
    28 
    28 
    29 #include "map.h"
    29 #include "map.h"
    30 #include "slope_type.h"
    30 #include "slope_type.h"
    31 #include "vehicle_type.h"
       
    32 
    31 
    33 // Forward declarations of structs.
    32 // Forward declarations of structs.
    34 struct Depot;
    33 struct Depot;
    35 struct Waypoint;
    34 struct Waypoint;
    36 struct Station;
    35 struct Station;
    39 struct NewsItem;
    38 struct NewsItem;
    40 struct Industry;
    39 struct Industry;
    41 struct DrawPixelInfo;
    40 struct DrawPixelInfo;
    42 struct Group;
    41 struct Group;
    43 typedef byte VehicleOrderID;  ///< The index of an order within its current vehicle (not pool related)
    42 typedef byte VehicleOrderID;  ///< The index of an order within its current vehicle (not pool related)
    44 typedef byte CargoID;
       
    45 typedef byte LandscapeID;
    43 typedef byte LandscapeID;
    46 typedef uint32 SpriteID;      ///< The number of a sprite, without mapping bits and colortables
    44 typedef uint32 SpriteID;      ///< The number of a sprite, without mapping bits and colortables
    47 struct PalSpriteID {
    45 struct PalSpriteID {
    48 	SpriteID sprite;
    46 	SpriteID sprite;
    49 	SpriteID pal;
    47 	SpriteID pal;
   231 	GDType line_reverse_mode;
   229 	GDType line_reverse_mode;
   232 	GDType disasters;
   230 	GDType disasters;
   233 	GDType town_council_tolerance; // minimum required town ratings to be allowed to demolish stuff
   231 	GDType town_council_tolerance; // minimum required town ratings to be allowed to demolish stuff
   234 };
   232 };
   235 
   233 
   236 enum {
       
   237 	// Temperate
       
   238 	CT_PASSENGERS   =  0,
       
   239 	CT_COAL         =  1,
       
   240 	CT_MAIL         =  2,
       
   241 	CT_OIL          =  3,
       
   242 	CT_LIVESTOCK    =  4,
       
   243 	CT_GOODS        =  5,
       
   244 	CT_GRAIN        =  6,
       
   245 	CT_WOOD         =  7,
       
   246 	CT_IRON_ORE     =  8,
       
   247 	CT_STEEL        =  9,
       
   248 	CT_VALUABLES    = 10,
       
   249 
       
   250 	// Arctic
       
   251 	CT_WHEAT        =  6,
       
   252 	CT_HILLY_UNUSED =  8,
       
   253 	CT_PAPER        =  9,
       
   254 	CT_GOLD         = 10,
       
   255 	CT_FOOD         = 11,
       
   256 
       
   257 	// Tropic
       
   258 	CT_RUBBER       =  1,
       
   259 	CT_FRUIT        =  4,
       
   260 	CT_MAIZE        =  6,
       
   261 	CT_COPPER_ORE   =  8,
       
   262 	CT_WATER        =  9,
       
   263 	CT_DIAMONDS     = 10,
       
   264 
       
   265 	// Toyland
       
   266 	CT_SUGAR        =  1,
       
   267 	CT_TOYS         =  3,
       
   268 	CT_BATTERIES    =  4,
       
   269 	CT_CANDY        =  5,
       
   270 	CT_TOFFEE       =  6,
       
   271 	CT_COLA         =  7,
       
   272 	CT_COTTON_CANDY =  8,
       
   273 	CT_BUBBLES      =  9,
       
   274 	CT_PLASTIC      = 10,
       
   275 	CT_FIZZY_DRINKS = 11,
       
   276 
       
   277 	NUM_CARGO       = 32,
       
   278 
       
   279 	CT_NO_REFIT     = 0xFE,
       
   280 	CT_INVALID      = 0xFF
       
   281 };
       
   282 
       
   283 typedef uint AcceptedCargo[NUM_CARGO];
       
   284 
       
   285 struct TileDesc {
   234 struct TileDesc {
   286 	StringID str;
   235 	StringID str;
   287 	Owner owner;
   236 	Owner owner;
   288 	Date build_date;
   237 	Date build_date;
   289 	uint64 dparam[2];
   238 	uint64 dparam[2];
   291 
   240 
   292 struct ViewportSign {
   241 struct ViewportSign {
   293 	int32 left;
   242 	int32 left;
   294 	int32 top;
   243 	int32 top;
   295 	byte width_1, width_2;
   244 	byte width_1, width_2;
   296 };
       
   297 
       
   298 
       
   299 #include "command_type.h"
       
   300 typedef void DrawTileProc(TileInfo *ti);
       
   301 typedef uint GetSlopeZProc(TileIndex tile, uint x, uint y);
       
   302 typedef CommandCost ClearTileProc(TileIndex tile, byte flags);
       
   303 typedef void GetAcceptedCargoProc(TileIndex tile, AcceptedCargo res);
       
   304 typedef void GetTileDescProc(TileIndex tile, TileDesc *td);
       
   305 /**
       
   306  * GetTileTrackStatusProcs return a value that contains the possible tracks
       
   307  * that can be taken on a given tile by a given transport. The return value is
       
   308  * composed as follows: 0xaabbccdd. ccdd and aabb are bitmasks of trackdirs,
       
   309  * where bit n corresponds to trackdir n. ccdd are the trackdirs that are
       
   310  * present in the tile (1==present, 0==not present), aabb is the signal
       
   311  * status, if applicable (0==green/no signal, 1==red, note that this is
       
   312  * reversed from map3/2[tile] for railway signals).
       
   313  *
       
   314  * The result (let's call it ts) is often used as follows:
       
   315  * tracks = (byte)(ts | ts >>8)
       
   316  * This effectively converts the present part of the result (ccdd) to a
       
   317  * track bitmask, which disregards directions. Normally, this is the same as just
       
   318  * doing (byte)ts I think, although I am not really sure
       
   319  *
       
   320  * A trackdir is combination of a track and a dir, where the lower three bits
       
   321  * are a track, the fourth bit is the direction. these give 12 (or 14)
       
   322  * possible options: 0-5 and 8-13, so we need 14 bits for a trackdir bitmask
       
   323  * above.
       
   324  * @param tile     the tile to get the track status from
       
   325  * @param mode     the mode of transportation
       
   326  * @param sub_mode used to differentiate between different kinds within the mode
       
   327  * @return the above mentions track status information
       
   328  */
       
   329 typedef uint32 GetTileTrackStatusProc(TileIndex tile, TransportType mode, uint sub_mode);
       
   330 typedef void GetProducedCargoProc(TileIndex tile, CargoID *b);
       
   331 typedef void ClickTileProc(TileIndex tile);
       
   332 typedef void AnimateTileProc(TileIndex tile);
       
   333 typedef void TileLoopProc(TileIndex tile);
       
   334 typedef void ChangeTileOwnerProc(TileIndex tile, PlayerID old_player, PlayerID new_player);
       
   335 /** @see VehicleEnterTileStatus to see what the return values mean */
       
   336 typedef uint32 VehicleEnterTileProc(Vehicle *v, TileIndex tile, int x, int y);
       
   337 typedef Foundation GetFoundationProc(TileIndex tile, Slope tileh);
       
   338 /**
       
   339  * Called when a tile is affected by a terraforming operation.
       
   340  * The function has to check if terraforming of the tile is allowed and return extra terraform-cost that depend on the tiletype.
       
   341  * With DC_EXEC in flags it has to perform tiletype-specific actions (like clearing land etc., but not the terraforming itself).
       
   342  *
       
   343  * @note The terraforming has not yet taken place. So GetTileZ() and GetTileSlope() refer to the landscape before the terraforming operation.
       
   344  *
       
   345  * @param tile      The involved tile.
       
   346  * @param flags     Command flags passed to the terraform command (DC_EXEC, DC_QUERY_COST, etc.).
       
   347  * @param z_new     TileZ after terraforming.
       
   348  * @param tileh_new Slope after terraforming.
       
   349  * @return Error code or extra cost for terraforming (like clearing land, building foundations, etc., but not the terraforming itself.)
       
   350  */
       
   351 typedef CommandCost TerraformTileProc(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new);
       
   352 
       
   353 struct TileTypeProcs {
       
   354 	DrawTileProc *draw_tile_proc;
       
   355 	GetSlopeZProc *get_slope_z_proc;
       
   356 	ClearTileProc *clear_tile_proc;
       
   357 	GetAcceptedCargoProc *get_accepted_cargo_proc;
       
   358 	GetTileDescProc *get_tile_desc_proc;
       
   359 	GetTileTrackStatusProc *get_tile_track_status_proc;
       
   360 	ClickTileProc *click_tile_proc;
       
   361 	AnimateTileProc *animate_tile_proc;
       
   362 	TileLoopProc *tile_loop_proc;
       
   363 	ChangeTileOwnerProc *change_tile_owner_proc;
       
   364 	GetProducedCargoProc *get_produced_cargo_proc;
       
   365 	VehicleEnterTileProc *vehicle_enter_tile_proc;
       
   366 	GetFoundationProc *get_foundation_proc;
       
   367 	TerraformTileProc *terraform_tile_proc;
       
   368 };
   245 };
   369 
   246 
   370 typedef void PlaceProc(TileIndex tile);
   247 typedef void PlaceProc(TileIndex tile);
   371 
   248 
   372 enum {
   249 enum {