station_newgrf.h
author Darkvater
Sat, 28 Jan 2006 13:43:45 +0000
changeset 2909 d18b01939421
parent 2625 66b3d632dcd2
permissions -rw-r--r--
(svn r3464) - Fix: restate some of the sprites in their old spaces. Was missed out because the patch was so huge. Thanks to Tron for pointing out the command of diff to ignore whitespace-only changes (--diff-cmd diff -x -ub)
2625
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
     1
/* $Id$ */
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
     2
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
     3
/** @file station_newgrf.h Header file for NewGRF stations */
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
     4
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
     5
#ifndef STATION_NEWGRF_H
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
     6
#define STATION_NEWGRF_H
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
     7
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
     8
#include "engine.h"
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
     9
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    10
typedef enum {
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    11
	STAT_CLASS_DFLT,     ///< Default station class.
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    12
	STAT_CLASS_WAYP,     ///< Waypoint class.
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    13
	STAT_CLASS_MAX = 16, ///< Maximum number of classes.
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    14
} StationClassID;
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    15
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    16
/* Station layout for given dimensions - it is a two-dimensional array
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    17
 * where index is computed as (x * platforms) + platform. */
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    18
typedef byte *StationLayout;
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    19
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    20
typedef struct stationspec {
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    21
	uint32 grfid; ///< ID of GRF file station belongs to.
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    22
	int localidx; ///< Index within GRF file of station.
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    23
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    24
	StationClassID sclass; ///< The class to which this spec belongs.
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    25
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    26
	/**
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    27
	 * Bitmask of number of platforms available for the station.
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    28
	 * 0..6 correpsond to 1..7, while bit 7 corresponds to >7 platforms.
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    29
	 */
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    30
	byte allowed_platforms;
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    31
	/**
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    32
	 * Bitmask of platform lengths available for the station.
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    33
	 * 0..6 correpsond to 1..7, while bit 7 corresponds to >7 tiles long.
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    34
	 */
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    35
	byte allowed_lengths;
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    36
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    37
	/** Number of tile layouts.
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    38
	 * A minimum of 8 is required is required for stations.
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    39
	 * 0-1 = plain platform
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    40
	 * 2-3 = platform with building
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    41
	 * 4-5 = platform with roof, left side
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    42
	 * 6-7 = platform with roof, right side
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    43
	 */
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    44
	int tiles;
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    45
	DrawTileSprites *renderdata; ///< Array of tile layouts.
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    46
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    47
	byte lengths;
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    48
	byte *platforms;
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    49
	StationLayout **layouts;
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    50
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    51
	/**
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    52
	 * NUM_GLOBAL_CID sprite groups.
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    53
	 * Used for obtaining the sprite offset of custom sprites, and for
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    54
	 * evaluating callbacks.
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    55
	 */
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    56
	SpriteGroup *spritegroup[NUM_GLOBAL_CID];
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    57
} StationSpec;
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    58
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    59
/**
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    60
 * Struct containing information relating to station classes.
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    61
 */
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    62
typedef struct stationclass {
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    63
	uint32 id;          ///< ID of this class, e.g. 'DFLT', 'WAYP', etc.
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    64
	char *name;         ///< Name of this class.
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    65
	uint stations;      ///< Number of stations in this class.
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    66
	StationSpec **spec; ///< Array of station specifications.
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    67
} StationClass;
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    68
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    69
void ResetStationClasses(void);
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    70
StationClassID AllocateStationClass(uint32 class);
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    71
void SetStationClassName(StationClassID sclass, const char *name);
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    72
uint GetNumCustomStations(StationClassID sclass);
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    73
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    74
void SetCustomStation(StationSpec *spec);
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    75
const StationSpec *GetCustomStation(StationClassID sclass, uint station);
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    76
66b3d632dcd2 (svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
diff changeset
    77
#endif /* STATION_NEWGRF_H */