00001
00002
00003
00004
00005
00006
00007
00008
00009
00012 #ifndef NEWGRF_STATION_H
00013 #define NEWGRF_STATION_H
00014
00015 #include "newgrf_animation_type.h"
00016 #include "newgrf_callbacks.h"
00017 #include "newgrf_class.h"
00018 #include "newgrf_commons.h"
00019 #include "sprite.h"
00020 #include "cargo_type.h"
00021 #include "station_type.h"
00022 #include "rail_type.h"
00023
00024 enum StationClassID {
00025 STAT_CLASS_BEGIN = 0,
00026 STAT_CLASS_DFLT = 0,
00027 STAT_CLASS_WAYP,
00028 STAT_CLASS_MAX = 32,
00029 };
00030 typedef SimpleTinyEnumT<StationClassID, byte> StationClassIDByte;
00031 template <> struct EnumPropsT<StationClassID> : MakeEnumPropsT<StationClassID, byte, STAT_CLASS_BEGIN, STAT_CLASS_MAX, STAT_CLASS_MAX, 8> {};
00032
00034 DECLARE_POSTFIX_INCREMENT(StationClassID)
00035
00036 enum StationSpecFlags {
00037 SSF_SEPARATE_GROUND,
00038 SSF_DIV_BY_STATION_SIZE,
00039 SSF_CB141_RANDOM_BITS,
00040 SSF_CUSTOM_FOUNDATIONS,
00041 SSF_EXTENDED_FOUNDATIONS,
00042 };
00043
00044
00045
00046 typedef byte *StationLayout;
00047
00049 struct StationSpec {
00056 GRFFilePropsBase<NUM_CARGO + 3> grf_prop;
00057 StationClassID cls_id;
00058 StringID name;
00059
00064 byte disallowed_platforms;
00069 byte disallowed_lengths;
00070
00079 uint tiles;
00080 DrawTileSprites *renderdata;
00081 bool copied_renderdata;
00082
00087 uint16 cargo_threshold;
00088
00089 uint32 cargo_triggers;
00090
00091 byte callback_mask;
00092
00093 byte flags;
00094
00095 byte pylons;
00096 byte wires;
00097 byte blocked;
00098
00099 AnimationInfo animation;
00100
00101 byte lengths;
00102 byte *platforms;
00103 StationLayout **layouts;
00104 bool copied_layouts;
00105 };
00106
00108 typedef NewGRFClass<StationSpec, StationClassID, STAT_CLASS_MAX> StationClass;
00109
00110 const StationSpec *GetStationSpec(TileIndex t);
00111
00112
00113 uint32 GetPlatformInfo(Axis axis, byte tile, int platforms, int length, int x, int y, bool centred);
00114
00115
00116
00117
00118 SpriteID GetCustomStationRelocation(const StationSpec *statspec, const BaseStation *st, TileIndex tile);
00119 SpriteID GetCustomStationGroundRelocation(const StationSpec *statspec, const BaseStation *st, TileIndex tile);
00120 SpriteID GetCustomStationFoundationRelocation(const StationSpec *statspec, const BaseStation *st, TileIndex tile);
00121 uint16 GetStationCallback(CallbackID callback, uint32 param1, uint32 param2, const StationSpec *statspec, const BaseStation *st, TileIndex tile);
00122
00123
00124 int AllocateSpecToStation(const StationSpec *statspec, BaseStation *st, bool exec);
00125
00126
00127 void DeallocateSpecFromStation(BaseStation *st, byte specindex);
00128
00129
00130 bool DrawStationTile(int x, int y, RailType railtype, Axis axis, StationClassID sclass, uint station);
00131
00132 void AnimateStationTile(TileIndex tile);
00133 void TriggerStationAnimation(const BaseStation *st, TileIndex tile, StationAnimationTrigger trigger, CargoID cargo_type = CT_INVALID);
00134 void StationUpdateAnimTriggers(BaseStation *st);
00135
00136 #endif