Feature: Hotkey to honk a vehicle's horn (#10110)

This commit is contained in:
Artin Alavi
2022-11-10 12:36:18 -08:00
committed by GitHub
parent 27e1d057c5
commit fd4f148c62
10 changed files with 60 additions and 42 deletions

View File

@@ -272,16 +272,10 @@ void Ship::MarkDirty()
this->UpdateCache();
}
static void PlayShipSound(const Vehicle *v)
void Ship::PlayLeaveStationSound(bool force) const
{
if (!PlayVehicleSound(v, VSE_START)) {
SndPlayVehicleFx(ShipVehInfo(v->engine_type)->sfx, v);
}
}
void Ship::PlayLeaveStationSound() const
{
PlayShipSound(this);
if (PlayVehicleSound(this, VSE_START, force)) return;
SndPlayVehicleFx(ShipVehInfo(this->engine_type)->sfx, this);
}
TileIndex Ship::GetOrderStationLocation(StationID station)
@@ -398,7 +392,7 @@ static bool CheckShipLeaveDepot(Ship *v)
v->UpdateViewport(true, true);
SetWindowDirty(WC_VEHICLE_DEPOT, v->tile);
PlayShipSound(v);
v->PlayLeaveStationSound();
VehicleServiceInDepot(v);
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
SetWindowClassesDirty(WC_SHIPS_LIST);