Files @ r4855:00332ec5d245
Branch filter:

Location: cpp/openttd-patchpack/source/newgrf_station.h - annotation

peter1138
(svn r6781) - Fix (r5926): Some house introduction dates were incorrectly adjusted in the move to 32bit dates.
r2963:056135abdc92
r2963:056135abdc92
r2963:056135abdc92
r2963:056135abdc92
r2963:056135abdc92
r2963:056135abdc92
r2963:056135abdc92
r2963:056135abdc92
r3866:89c9bb7440d9
r2963:056135abdc92
r2963:056135abdc92
r2963:056135abdc92
r2963:056135abdc92
r3767:1de2c992675f
r2963:056135abdc92
r2963:056135abdc92
r2963:056135abdc92
r2963:056135abdc92
r2963:056135abdc92
r2963:056135abdc92
r3688:1c98c5f908a8
r2963:056135abdc92
r2963:056135abdc92
r2963:056135abdc92
r3780:8c041ef429a9
r3780:8c041ef429a9
r2963:056135abdc92
r3594:55a15a8d5ad3
r2963:056135abdc92
r2963:056135abdc92
r2963:056135abdc92
r2963:056135abdc92
r2963:056135abdc92
r3505:7910967480fd
r2963:056135abdc92
r2963:056135abdc92
r2963:056135abdc92
r2963:056135abdc92
r3505:7910967480fd
r2963:056135abdc92
r2963:056135abdc92
r2963:056135abdc92
r2963:056135abdc92
r2963:056135abdc92
r2963:056135abdc92
r2963:056135abdc92
r2963:056135abdc92
r3570:25c5613dab12
r2963:056135abdc92
r3740:48a69333a3fb
r2963:056135abdc92
r3505:7910967480fd
r3505:7910967480fd
r3505:7910967480fd
r3505:7910967480fd
r3505:7910967480fd
r3505:7910967480fd
r3505:7910967480fd
r3505:7910967480fd
r3505:7910967480fd
r3505:7910967480fd
r3505:7910967480fd
r3505:7910967480fd
r3505:7910967480fd
r3505:7910967480fd
r3505:7910967480fd
r2963:056135abdc92
r2963:056135abdc92
r2963:056135abdc92
r2963:056135abdc92
r2963:056135abdc92
r2963:056135abdc92
r2963:056135abdc92
r2963:056135abdc92
r2963:056135abdc92
r3865:0243666a5a41
r2963:056135abdc92
r2963:056135abdc92
r2963:056135abdc92
r2963:056135abdc92
r2963:056135abdc92
r3688:1c98c5f908a8
r2963:056135abdc92
r3594:55a15a8d5ad3
r2963:056135abdc92
r2963:056135abdc92
r2963:056135abdc92
r2963:056135abdc92
r2963:056135abdc92
r3900:1c2675abec23
r3642:2b0b79072b03
r3642:2b0b79072b03
r3642:2b0b79072b03
r3642:2b0b79072b03
r3587:3a7498e030bb
r2963:056135abdc92
r2963:056135abdc92
r3676:3002164413eb
r3676:3002164413eb
r3765:c9eaea3d3f78
r2963:056135abdc92
r3769:89753c95a829
r3769:89753c95a829
r3769:89753c95a829
r2967:057d1efdd692
r3751:cd578c103755
r3751:cd578c103755
r3751:cd578c103755
r3775:510ec99b1193
r3752:85b7cb41a720
r2967:057d1efdd692
r3766:1027557fc8c9
r3766:1027557fc8c9
r3766:1027557fc8c9
r3789:3315a8fd7907
r3789:3315a8fd7907
r3789:3315a8fd7907
r3587:3a7498e030bb
r3676:3002164413eb
r3587:3a7498e030bb
r3587:3a7498e030bb
r4190:9892fffe53dd
r3587:3a7498e030bb
r3764:4a2ca18ddafd
r3764:4a2ca18ddafd
r3764:4a2ca18ddafd
r2963:056135abdc92
/* $Id$ */

/** @file newgrf_station.h Header file for NewGRF stations */

#ifndef NEWGRF_STATION_H
#define NEWGRF_STATION_H

#include "engine.h"
#include "newgrf_cargo.h"

typedef enum {
	STAT_CLASS_DFLT,     ///< Default station class.
	STAT_CLASS_WAYP,     ///< Waypoint class.
	STAT_CLASS_MAX = 32, ///< Maximum number of classes.
} StationClassID;

/* Station layout for given dimensions - it is a two-dimensional array
 * where index is computed as (x * platforms) + platform. */
typedef byte *StationLayout;

typedef struct StationSpec {
	uint32 grfid; ///< ID of GRF file station belongs to.
	int localidx; ///< Index within GRF file of station.

	bool allocated; ///< Flag whether this station has been added to a station class list

	StationClassID sclass; ///< The class to which this spec belongs.
	StringID name; ///< Name of this station.

	/**
	 * Bitmask of number of platforms available for the station.
	 * 0..6 correpsond to 1..7, while bit 7 corresponds to >7 platforms.
	 */
	byte disallowed_platforms;
	/**
	 * Bitmask of platform lengths available for the station.
	 * 0..6 correpsond to 1..7, while bit 7 corresponds to >7 tiles long.
	 */
	byte disallowed_lengths;

	/** Number of tile layouts.
	 * A minimum of 8 is required is required for stations.
	 * 0-1 = plain platform
	 * 2-3 = platform with building
	 * 4-5 = platform with roof, left side
	 * 6-7 = platform with roof, right side
	 */
	uint tiles;
	DrawTileSprites *renderdata; ///< Array of tile layouts.
	bool copied_renderdata;

	/** Cargo threshold for choosing between little and lots of cargo
	 * @note little/lots are equivalent to the moving/loading states for vehicles
	 */
	uint16 cargo_threshold;

	uint32 cargo_triggers; ///< Bitmask of cargo types which cause trigger re-randomizing

	byte callbackmask; ///< Bitmask of callbacks to use, @see newgrf_callbacks.h

	byte flags; ///< Bitmask of flags, bit 0: use different sprite set; bit 1: divide cargo about by station size

	byte pylons;  ///< Bitmask of base tiles (0 - 7) which should contain elrail pylons
	byte wires;   ///< Bitmask of base tiles (0 - 7) which should contain elrail wires
	byte blocked; ///< Bitmask of base tiles (0 - 7) which are blocked to trains

	byte lengths;
	byte *platforms;
	StationLayout **layouts;

	/**
	 * NUM_GLOBAL_CID sprite groups.
	 * Used for obtaining the sprite offset of custom sprites, and for
	 * evaluating callbacks.
	 */
	struct SpriteGroup *spritegroup[NUM_GLOBAL_CID];
} StationSpec;

/**
 * Struct containing information relating to station classes.
 */
typedef struct StationClass {
	uint32 id;          ///< ID of this class, e.g. 'DFLT', 'WAYP', etc.
	StringID name;      ///< Name of this class.
	uint stations;      ///< Number of stations in this class.
	StationSpec **spec; ///< Array of station specifications.
} StationClass;

void ResetStationClasses(void);
StationClassID AllocateStationClass(uint32 cls);
void SetStationClassName(StationClassID sclass, StringID name);
StringID GetStationClassName(StationClassID sclass);
StringID *BuildStationClassDropdown(void);

uint GetNumStationClasses(void);
uint GetNumCustomStations(StationClassID sclass);

void SetCustomStationSpec(StationSpec *statspec);
const StationSpec *GetCustomStationSpec(StationClassID sclass, uint station);
const StationSpec *GetCustomStationSpecByGrf(uint32 grfid, byte localidx);

/* Evaluate a tile's position within a station, and return the result a bitstuffed format. */
uint32 GetPlatformInfo(Axis axis, byte tile, int platforms, int length, int x, int y, bool centred);

/* Get sprite offset for a given custom station and station structure (may be
 * NULL - that means we are in a build dialog). The station structure is used
 * for variational sprite groups. */
SpriteID GetCustomStationRelocation(const StationSpec *statspec, const Station *st, TileIndex tile);
SpriteID GetCustomStationGroundRelocation(const StationSpec *statspec, const Station *st, TileIndex tile);
uint16 GetStationCallback(uint16 callback, uint32 param1, uint32 param2, const StationSpec *statspec, const Station *st, TileIndex tile);

/* Check if a rail station tile is traversable. */
bool IsStationTileBlocked(TileIndex tile);

/* Check if a rail station tile is electrifiable. */
bool IsStationTileElectrifiable(TileIndex tile);

/* Allocate a StationSpec to a Station. This is called once per build operation. */
int AllocateSpecToStation(const StationSpec *statspec, Station *st, bool exec);

/* Deallocate a StationSpec from a Station. Called when removing a single station tile. */
void DeallocateSpecFromStation(Station* st, byte specindex);

/* Draw representation of a station tile for GUI purposes. */
bool DrawStationTile(int x, int y, RailType railtype, Axis axis, StationClassID sclass, uint station);

#endif /* NEWGRF_STATION_H */