Header file for NewGRF stations. More...
#include "newgrf_callbacks.h"
#include "sprite.h"
#include "direction_type.h"
#include "cargo_type.h"
#include "strings_type.h"
#include "station_type.h"
#include "rail_type.h"
Go to the source code of this file.
Data Structures | |
struct | EnumPropsT< StationClassID > |
struct | StationSpec |
struct | StationClass |
Struct containing information relating to station classes. More... | |
Typedefs | |
typedef SimpleTinyEnumT < StationClassID, byte > | StationClassIDByte |
typedef byte * | StationLayout |
Enumerations | |
enum | StationClassID { STAT_CLASS_BEGIN = 0, STAT_CLASS_DFLT = 0, STAT_CLASS_WAYP, STAT_CLASS_MAX = 32 } |
enum | StationSpecFlags { SSF_SEPARATE_GROUND, SSF_DIV_BY_STATION_SIZE, SSF_CB141_RANDOM_BITS, SSF_CUSTOM_FOUNDATIONS, SSF_EXTENDED_FOUNDATIONS } |
enum | StatAnimTrigger { STAT_ANIM_BUILT, STAT_ANIM_NEW_CARGO, STAT_ANIM_CARGO_TAKEN, STAT_ANIM_TRAIN_ARRIVES, STAT_ANIM_TRAIN_DEPARTS, STAT_ANIM_TRAIN_LOADS, STAT_ANIM_250_TICKS } |
Functions | |
DECLARE_POSTFIX_INCREMENT (StationClassID) | |
Allow incrementing of StationClassID variables. | |
void | ResetStationClasses () |
Reset station classes to their default state. | |
StationClassID | AllocateStationClass (uint32 cls) |
Allocate a station class for the given class id. | |
void | SetStationClassName (StationClassID sclass, StringID name) |
Set the name of a custom station class. | |
StringID | GetStationClassName (StationClassID sclass) |
Retrieve the name of a custom station class. | |
const StationSpec * | GetStationSpec (TileIndex t) |
uint | GetNumStationClasses () |
Get the number of station classes in use. | |
uint | GetNumCustomStations (StationClassID sclass) |
Return the number of stations for the given station class. | |
void | SetCustomStationSpec (StationSpec *statspec) |
Tie a station spec to its station class. | |
const StationSpec * | GetCustomStationSpec (StationClassID sclass, uint station) |
Retrieve a station spec from a class. | |
const StationSpec * | GetCustomStationSpecByGrf (uint32 grfid, byte localidx, int *index) |
Retrieve a station spec by GRF location. | |
uint32 | GetPlatformInfo (Axis axis, byte tile, int platforms, int length, int x, int y, bool centred) |
SpriteID | GetCustomStationRelocation (const StationSpec *statspec, const BaseStation *st, TileIndex tile) |
SpriteID | GetCustomStationGroundRelocation (const StationSpec *statspec, const BaseStation *st, TileIndex tile) |
SpriteID | GetCustomStationFoundationRelocation (const StationSpec *statspec, const BaseStation *st, TileIndex tile) |
uint16 | GetStationCallback (CallbackID callback, uint32 param1, uint32 param2, const StationSpec *statspec, const BaseStation *st, TileIndex tile) |
int | AllocateSpecToStation (const StationSpec *statspec, BaseStation *st, bool exec) |
Allocate a StationSpec to a Station. | |
void | DeallocateSpecFromStation (BaseStation *st, byte specindex) |
Deallocate a StationSpec from a Station. | |
bool | DrawStationTile (int x, int y, RailType railtype, Axis axis, StationClassID sclass, uint station) |
Draw representation of a station tile for GUI purposes. | |
void | AnimateStationTile (TileIndex tile) |
void | StationAnimationTrigger (const BaseStation *st, TileIndex tile, StatAnimTrigger trigger, CargoID cargo_type=CT_INVALID) |
void | StationUpdateAnimTriggers (BaseStation *st) |
Update the cached animation trigger bitmask for a station. |
Header file for NewGRF stations.
Definition in file newgrf_station.h.
enum StationClassID |
STAT_CLASS_BEGIN |
the lowest valid value |
STAT_CLASS_DFLT |
Default station class. |
STAT_CLASS_WAYP |
Waypoint class. |
STAT_CLASS_MAX |
Maximum number of classes. |
Definition at line 23 of file newgrf_station.h.
enum StationSpecFlags |
Definition at line 35 of file newgrf_station.h.
int AllocateSpecToStation | ( | const StationSpec * | statspec, | |
BaseStation * | st, | |||
bool | exec | |||
) |
Allocate a StationSpec to a Station.
This is called once per build operation.
statspec | StationSpec to allocate. | |
st | Station to allocate it to. | |
exec | Whether to actually allocate the spec. |
Definition at line 785 of file newgrf_station.cpp.
References StationSpec::grffile, StationSpecList::grfid, StationSpec::localidx, StationSpecList::localidx, BaseStation::num_specs, ReallocT(), and BaseStation::speclist.
Referenced by CmdBuildRailStation(), CmdBuildRailWaypoint(), and MoveWaypointsToBaseStations().
StationClassID AllocateStationClass | ( | uint32 | cls | ) |
Allocate a station class for the given class id.
cls | A 32 bit value identifying the class. |
Definition at line 117 of file newgrf_station.cpp.
References grfmsg(), StationClass::id, STAT_CLASS_BEGIN, STAT_CLASS_DFLT, and STAT_CLASS_MAX.
void DeallocateSpecFromStation | ( | BaseStation * | st, | |
byte | specindex | |||
) |
Deallocate a StationSpec from a Station.
Called when removing a single station tile.
st | Station to work with. | |
specindex | Index of the custom station within the Station's spec list. |
Definition at line 835 of file newgrf_station.cpp.
References BaseStation::cached_anim_triggers, GetCustomStationSpecIndex(), StationSpecList::grfid, INVALID_TILE, StationSpecList::localidx, BaseStation::num_specs, ReallocT(), BaseStation::speclist, StationUpdateAnimTriggers(), TILE_AREA_LOOP, and BaseStation::TileBelongsToRailStation().
Referenced by CmdBuildRailStation(), CmdBuildRailWaypoint(), and RemoveFromRailBaseStation().
bool DrawStationTile | ( | int | x, | |
int | y, | |||
RailType | railtype, | |||
Axis | axis, | |||
StationClassID | sclass, | |||
uint | station | |||
) |
Draw representation of a station tile for GUI purposes.
x | Position x of image. | |
y | Position y of image. | |
axis | Axis. | |
railtype | Rail type. | |
sclass,station | Type of station. | |
station | station ID |
Definition at line 880 of file newgrf_station.cpp.
References CALLBACK_FAILED, StationSpec::callback_mask, CBID_STATION_SPRITE_LAYOUT, CBM_STATION_SPRITE_LAYOUT, RailtypeInfo::custom_ground_offset, DrawRailTileSeqInGUI(), DrawSprite(), GetCustomStationSpec(), GetRailTypeInfo(), DrawTileSprites::ground, GroundSpritePaletteTransform(), HasBit(), INVALID_TILE, PalSpriteID::pal, StationSpec::renderdata, PalSpriteID::sprite, SPRITE_MODIFIER_CUSTOM_SPRITE, StationSpec::tiles, and RailtypeInfo::total_offset.
Referenced by DrawWaypointSprite(), and BuildRailStationWindow::DrawWidget().
const StationSpec* GetCustomStationSpec | ( | StationClassID | sclass, | |
uint | station | |||
) |
Retrieve a station spec from a class.
sclass | Index of the station class. | |
station | The station index with the class. |
Definition at line 198 of file newgrf_station.cpp.
References StationClass::spec, and STAT_CLASS_MAX.
Referenced by CmdBuildRailStation(), CmdBuildRailWaypoint(), DrawStationTile(), BuildRailStationWindow::DrawWidget(), MoveWaypointsToBaseStations(), BuildRailWaypointWindow::OnClick(), BuildRailStationWindow::OnClick(), BuildRailStationWindow::OnDropdownSelect(), BuildRailWaypointWindow::OnPaint(), BuildRailStationWindow::OnPaint(), and BuildRailStationWindow::UpdateWidgetSize().
const StationSpec* GetCustomStationSpecByGrf | ( | uint32 | grfid, | |
byte | localidx, | |||
int * | index | |||
) |
Retrieve a station spec by GRF location.
grfid | GRF ID of station spec. | |
localidx | Index within GRF file of station spec. | |
index | Pointer to return the index of the station spec in its station class. If NULL then not used. |
Definition at line 216 of file newgrf_station.cpp.
References StationSpec::grffile, StationSpec::localidx, StationClass::spec, STAT_CLASS_BEGIN, STAT_CLASS_MAX, and StationClass::stations.
Referenced by AIRail::BuildNewGRFRailStation().
uint GetNumCustomStations | ( | StationClassID | sclass | ) |
Return the number of stations for the given station class.
sclass | Index of the station class. |
Definition at line 164 of file newgrf_station.cpp.
References STAT_CLASS_MAX, and StationClass::stations.
Referenced by BuildRailClick_Waypoint(), CmdBuildRailStation(), CmdBuildRailWaypoint(), MoveWaypointsToBaseStations(), BuildRailStationWindow::OnDropdownSelect(), ShowStationBuilder(), and BuildRailStationWindow::UpdateWidgetSize().
uint GetNumStationClasses | ( | ) |
Get the number of station classes in use.
Definition at line 152 of file newgrf_station.cpp.
References StationClass::id, and STAT_CLASS_MAX.
Referenced by BuildRailStationWindow::BuildStationClassDropDown(), CmdBuildRailStation(), ShowStationBuilder(), and BuildRailStationWindow::UpdateWidgetSize().
void ResetStationClasses | ( | ) |
Reset station classes to their default state.
This includes initialising the Default and Waypoint classes with an empty entry, for standard stations and waypoints.
Definition at line 87 of file newgrf_station.cpp.
References StationClass::id, StationClass::name, StationClass::spec, STAT_CLASS_BEGIN, STAT_CLASS_MAX, and StationClass::stations.
Referenced by ResetNewGRFData().
void SetCustomStationSpec | ( | StationSpec * | statspec | ) |
Tie a station spec to its station class.
statspec | The station spec. |
Definition at line 174 of file newgrf_station.cpp.
References StationSpec::allocated, ReallocT(), StationSpec::sclass, StationClass::spec, STAT_CLASS_MAX, and StationClass::stations.
void StationUpdateAnimTriggers | ( | BaseStation * | st | ) |
Update the cached animation trigger bitmask for a station.
st | Station to update. |
Definition at line 1075 of file newgrf_station.cpp.
References BaseStation::cached_anim_triggers, BaseStation::num_specs, and BaseStation::speclist.
Referenced by DeallocateSpecFromStation().