1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-15 16:32:41 +01:00

Fix #14561: Vehicle effects missing for vehicle on bridge. (#14563)

This commit is contained in:
Peter Nelson
2025-08-31 18:27:46 +01:00
committed by GitHub
parent 4b9afbe35b
commit febf8b0d57

View File

@@ -2754,6 +2754,22 @@ static void SpawnAdvancedVisualEffect(const Vehicle *v)
}
}
/**
* Test if a bridge is above a vehicle.
* @param v Vehicle to test.
* @return true iff a bridge is above the vehicle.
*/
static bool IsBridgeAboveVehicle(const Vehicle *v)
{
if (IsBridgeTile(v->tile)) {
/* If the vehicle is 'on' a bridge tile, check the real position of the vehicle. If it's different then the
* vehicle is on the middle of the bridge, which cannot have a bridge above. */
TileIndex tile = TileVirtXY(v->x_pos, v->y_pos);
if (tile != v->tile) return false;
}
return IsBridgeAbove(v->tile);
}
/**
* Draw visual effects (smoke and/or sparks) for a vehicle chain.
* @pre this->IsPrimaryVehicle()
@@ -2817,7 +2833,7 @@ void Vehicle::ShowVisualEffect() const
* - The vehicle is a train engine that is currently unpowered */
if (effect_model == VESM_NONE ||
v->vehstatus.Test(VehState::Hidden) ||
IsBridgeAbove(v->tile) ||
IsBridgeAboveVehicle(v) ||
IsDepotTile(v->tile) ||
IsTunnelTile(v->tile) ||
(v->type == VEH_TRAIN &&