1
0
Fork 0

Add: [NewGRF] Station/roadstop animation-triggers 'tile loop' (bit 7) and 'path reservation' (bit 8). (#14080)

pull/14092/head
frosch 2025-04-26 14:44:55 +02:00 committed by GitHub
parent d3ae6bc9a8
commit 1ea1dbd19e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 30 additions and 2 deletions

View File

@ -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);

View File

@ -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);
}
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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>;