Add: NewGRF road stops
This commit is contained in:
committed by
rubidium42
parent
a18182e24b
commit
4c1406a4b5
@@ -24,6 +24,17 @@ struct StationSpecList {
|
||||
uint8 localidx; ///< Station ID within GRF of station
|
||||
};
|
||||
|
||||
struct RoadStopSpecList {
|
||||
const RoadStopSpec *spec;
|
||||
uint32 grfid; ///< GRF ID of this custom road stop
|
||||
uint8 localidx; ///< Station ID within GRF of road stop
|
||||
};
|
||||
|
||||
struct RoadStopTileData {
|
||||
TileIndex tile;
|
||||
uint8 random_bits;
|
||||
uint8 animation_frame;
|
||||
};
|
||||
|
||||
/** StationRect - used to track station spread out rectangle - cheaper than scanning whole map */
|
||||
struct StationRect : public Rect {
|
||||
@@ -62,18 +73,23 @@ struct BaseStation : StationPool::PoolItem<&_station_pool> {
|
||||
Owner owner; ///< The owner of this station
|
||||
StationFacility facilities; ///< The facilities that this station has
|
||||
|
||||
std::vector<StationSpecList> speclist; ///< List of rail station specs of this station.
|
||||
std::vector<StationSpecList> speclist; ///< List of rail station specs of this station.
|
||||
std::vector<RoadStopSpecList> roadstop_speclist; ///< List of road stop specs of this station
|
||||
|
||||
Date build_date; ///< Date of construction
|
||||
|
||||
uint16 random_bits; ///< Random bits assigned to this station
|
||||
byte waiting_triggers; ///< Waiting triggers (NewGRF) for this station
|
||||
uint8 cached_anim_triggers; ///< NOSAVE: Combined animation trigger bitmask, used to determine if trigger processing should happen.
|
||||
CargoTypes cached_cargo_triggers; ///< NOSAVE: Combined cargo trigger bitmask
|
||||
uint8 cached_anim_triggers; ///< NOSAVE: Combined animation trigger bitmask, used to determine if trigger processing should happen.
|
||||
uint8 cached_roadstop_anim_triggers; ///< NOSAVE: Combined animation trigger bitmask for road stops, used to determine if trigger processing should happen.
|
||||
CargoTypes cached_cargo_triggers; ///< NOSAVE: Combined cargo trigger bitmask
|
||||
CargoTypes cached_roadstop_cargo_triggers; ///< NOSAVE: Combined cargo trigger bitmask for road stops
|
||||
|
||||
TileArea train_station; ///< Tile area the train 'station' part covers
|
||||
StationRect rect; ///< NOSAVE: Station spread out rectangle maintained by StationRect::xxx() functions
|
||||
|
||||
std::vector<RoadStopTileData> custom_roadstop_tile_data; ///< List of custom road stop tile data
|
||||
|
||||
/**
|
||||
* Initialize the base station.
|
||||
* @param tile The location of the station sign
|
||||
@@ -167,6 +183,30 @@ struct BaseStation : StationPool::PoolItem<&_station_pool> {
|
||||
return (this->facilities & ~FACIL_WAYPOINT) != 0;
|
||||
}
|
||||
|
||||
inline byte GetRoadStopRandomBits(TileIndex tile) const
|
||||
{
|
||||
for (const RoadStopTileData &tile_data : this->custom_roadstop_tile_data) {
|
||||
if (tile_data.tile == tile) return tile_data.random_bits;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline byte GetRoadStopAnimationFrame(TileIndex tile) const
|
||||
{
|
||||
for (const RoadStopTileData &tile_data : this->custom_roadstop_tile_data) {
|
||||
if (tile_data.tile == tile) return tile_data.animation_frame;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private:
|
||||
void SetRoadStopTileData(TileIndex tile, byte data, bool animation);
|
||||
|
||||
public:
|
||||
inline void SetRoadStopRandomBits(TileIndex tile, byte random_bits) { this->SetRoadStopTileData(tile, random_bits, false); }
|
||||
inline void SetRoadStopAnimationFrame(TileIndex tile, byte frame) { this->SetRoadStopTileData(tile, frame, true); }
|
||||
void RemoveRoadStopTileData(TileIndex tile);
|
||||
|
||||
static void PostDestructor(size_t index);
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user