peter1138@2625: /* $Id$ */ peter1138@2625: peter1138@2963: /** @file newgrf_station.h Header file for NewGRF stations */ peter1138@2625: peter1138@2963: #ifndef NEWGRF_STATION_H peter1138@2963: #define NEWGRF_STATION_H peter1138@2625: peter1138@2625: #include "engine.h" peter1138@2625: peter1138@2625: typedef enum { peter1138@2625: STAT_CLASS_DFLT, ///< Default station class. peter1138@2625: STAT_CLASS_WAYP, ///< Waypoint class. peter1138@2625: STAT_CLASS_MAX = 16, ///< Maximum number of classes. peter1138@2625: } StationClassID; peter1138@2625: peter1138@2625: /* Station layout for given dimensions - it is a two-dimensional array peter1138@2625: * where index is computed as (x * platforms) + platform. */ peter1138@2625: typedef byte *StationLayout; peter1138@2625: peter1138@2625: typedef struct stationspec { peter1138@2625: uint32 grfid; ///< ID of GRF file station belongs to. peter1138@2625: int localidx; ///< Index within GRF file of station. peter1138@2625: peter1138@2625: StationClassID sclass; ///< The class to which this spec belongs. peter1138@2625: peter1138@2625: /** peter1138@2625: * Bitmask of number of platforms available for the station. peter1138@2625: * 0..6 correpsond to 1..7, while bit 7 corresponds to >7 platforms. peter1138@2625: */ peter1138@2625: byte allowed_platforms; peter1138@2625: /** peter1138@2625: * Bitmask of platform lengths available for the station. peter1138@2625: * 0..6 correpsond to 1..7, while bit 7 corresponds to >7 tiles long. peter1138@2625: */ peter1138@2625: byte allowed_lengths; peter1138@2625: peter1138@2625: /** Number of tile layouts. peter1138@2625: * A minimum of 8 is required is required for stations. peter1138@2625: * 0-1 = plain platform peter1138@2625: * 2-3 = platform with building peter1138@2625: * 4-5 = platform with roof, left side peter1138@2625: * 6-7 = platform with roof, right side peter1138@2625: */ peter1138@2625: int tiles; peter1138@2625: DrawTileSprites *renderdata; ///< Array of tile layouts. peter1138@2625: peter1138@2625: byte lengths; peter1138@2625: byte *platforms; peter1138@2625: StationLayout **layouts; peter1138@2625: peter1138@2625: /** peter1138@2625: * NUM_GLOBAL_CID sprite groups. peter1138@2625: * Used for obtaining the sprite offset of custom sprites, and for peter1138@2625: * evaluating callbacks. peter1138@2625: */ peter1138@2625: SpriteGroup *spritegroup[NUM_GLOBAL_CID]; peter1138@2625: } StationSpec; peter1138@2625: peter1138@2625: /** peter1138@2625: * Struct containing information relating to station classes. peter1138@2625: */ peter1138@2625: typedef struct stationclass { peter1138@2625: uint32 id; ///< ID of this class, e.g. 'DFLT', 'WAYP', etc. peter1138@2625: char *name; ///< Name of this class. peter1138@2625: uint stations; ///< Number of stations in this class. peter1138@2625: StationSpec **spec; ///< Array of station specifications. peter1138@2625: } StationClass; peter1138@2625: peter1138@2625: void ResetStationClasses(void); peter1138@2625: StationClassID AllocateStationClass(uint32 class); peter1138@2625: void SetStationClassName(StationClassID sclass, const char *name); peter1138@2625: uint GetNumCustomStations(StationClassID sclass); peter1138@2625: peter1138@2625: void SetCustomStation(StationSpec *spec); peter1138@2625: const StationSpec *GetCustomStation(StationClassID sclass, uint station); peter1138@2625: peter1138@2967: /* Get sprite offset for a given custom station and station structure (may be peter1138@2967: * NULL if ctype is set - that means we are in a build dialog). The station peter1138@2967: * structure is used for variational sprite groups. */ peter1138@2967: uint32 GetCustomStationRelocation(const StationSpec *spec, const Station *st, byte ctype); peter1138@2967: peter1138@2963: #endif /* NEWGRF_STATION_H */