mirror of https://github.com/OpenTTD/OpenTTD
Add: [NewGRF] Station/roadstop animation-triggers 'tile loop' (bit 7) and 'path reservation' (bit 8). (#14080)
parent
d3ae6bc9a8
commit
1ea1dbd19e
|
@ -906,8 +906,17 @@ void TriggerStationAnimation(BaseStation *st, TileIndex trigger_tile, StationAni
|
|||
{
|
||||
/* List of coverage areas for each animation trigger */
|
||||
static const TriggerArea tas[] = {
|
||||
TA_TILE, TA_WHOLE, TA_WHOLE, TA_PLATFORM, TA_PLATFORM, TA_PLATFORM, TA_WHOLE
|
||||
TA_TILE, // Built
|
||||
TA_WHOLE, // NewCargo
|
||||
TA_WHOLE, // CargoTaken
|
||||
TA_PLATFORM, // VehicleArrives
|
||||
TA_PLATFORM, // VehicleDeparts
|
||||
TA_PLATFORM, // VehicleLoads
|
||||
TA_WHOLE, // AcceptanceTick
|
||||
TA_TILE, // TileLoop
|
||||
TA_PLATFORM, // PathReservation
|
||||
};
|
||||
static_assert(std::size(tas) == static_cast<size_t>(StationAnimationTrigger::End));
|
||||
|
||||
assert(st != nullptr);
|
||||
|
||||
|
|
|
@ -82,6 +82,7 @@ private:
|
|||
|
||||
auto *st = Station::GetByTile(start);
|
||||
TriggerStationRandomisation(st, start, StationRandomTrigger::PathReservation);
|
||||
TriggerStationAnimation(st, start, StationAnimationTrigger::PathReservation);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -114,6 +115,7 @@ private:
|
|||
if (IsRailWaypointTile(tile)) {
|
||||
auto *st = BaseStation::GetByTile(tile);
|
||||
TriggerStationRandomisation(st, tile, StationRandomTrigger::PathReservation);
|
||||
TriggerStationAnimation(st, tile, StationAnimationTrigger::PathReservation);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -116,6 +116,7 @@ bool TryReserveRailTrack(TileIndex tile, Track t, bool trigger_stations)
|
|||
if (trigger_stations) {
|
||||
auto *st = BaseStation::GetByTile(tile);
|
||||
TriggerStationRandomisation(st, tile, StationRandomTrigger::PathReservation);
|
||||
TriggerStationAnimation(st, tile, StationAnimationTrigger::PathReservation);
|
||||
}
|
||||
MarkTileDirtyByTile(tile); // some GRFs need redraw after reserving track
|
||||
return true;
|
||||
|
|
|
@ -3601,9 +3601,15 @@ static TrackStatus GetTileTrackStatus_Station(TileIndex tile, TransportType mode
|
|||
|
||||
static void TileLoop_Station(TileIndex tile)
|
||||
{
|
||||
auto *st = BaseStation::GetByTile(tile);
|
||||
switch (GetStationType(tile)) {
|
||||
case StationType::Airport:
|
||||
TriggerAirportTileAnimation(Station::GetByTile(tile), tile, AirportAnimationTrigger::TileLoop);
|
||||
TriggerAirportTileAnimation(Station::From(st), tile, AirportAnimationTrigger::TileLoop);
|
||||
break;
|
||||
|
||||
case StationType::Rail:
|
||||
case StationType::RailWaypoint:
|
||||
TriggerStationAnimation(st, tile, StationAnimationTrigger::TileLoop);
|
||||
break;
|
||||
|
||||
case StationType::Dock:
|
||||
|
@ -3615,6 +3621,11 @@ static void TileLoop_Station(TileIndex tile)
|
|||
TileLoop_Water(tile);
|
||||
break;
|
||||
|
||||
case StationType::Truck:
|
||||
case StationType::Bus:
|
||||
TriggerRoadStopAnimation(st, tile, StationAnimationTrigger::TileLoop);
|
||||
break;
|
||||
|
||||
case StationType::RoadWaypoint: {
|
||||
switch (_settings_game.game_creation.landscape) {
|
||||
case LandscapeType::Arctic:
|
||||
|
@ -3648,6 +3659,8 @@ static void TileLoop_Station(TileIndex tile)
|
|||
SetRoadWaypointRoadside(tile, cur_rs == ROADSIDE_BARREN ? new_rs : ROADSIDE_BARREN);
|
||||
MarkTileDirtyByTile(tile);
|
||||
}
|
||||
|
||||
TriggerRoadStopAnimation(st, tile, StationAnimationTrigger::TileLoop);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -96,6 +96,9 @@ enum class StationAnimationTrigger : uint8_t {
|
|||
VehicleDeparts, ///< Trigger platform when train leaves.
|
||||
VehicleLoads, ///< Trigger platform when train loads/unloads.
|
||||
AcceptanceTick, ///< Trigger station every 250 ticks.
|
||||
TileLoop, ///< Trigger in the periodic tile loop.
|
||||
PathReservation, ///< Trigger platform when train reserves path.
|
||||
End
|
||||
};
|
||||
using StationAnimationTriggers = EnumBitSet<StationAnimationTrigger, uint16_t>;
|
||||
|
||||
|
|
Loading…
Reference in New Issue