16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-23 03:59:18 +02:00

Overflow protection for wiper sound

This commit is contained in:
2026-01-09 21:32:33 +01:00
parent 3c2f4f5123
commit 8457d20257

View File

@@ -4195,14 +4195,14 @@ bool TDynamicObject::Update(double dt, double dt1)
} }
dWiperPos[i] = std::max(0.0, dWiperPos[i] - (1.f / currentWiperParams.WiperSpeed) * dt1); dWiperPos[i] = std::max(0.0, dWiperPos[i] - (1.f / currentWiperParams.WiperSpeed) * dt1);
} }
if (dWiperPos[i] == 1.0) // we reached end if (dWiperPos[i] >= 1.0) // we reached end
{ {
sWiperFromPark.stop(); sWiperFromPark.stop();
sWiperFromParkPlayed = false; sWiperFromParkPlayed = false;
wiperParkTimer[i] = 0.0; wiperParkTimer[i] = 0.0;
wiperDirection[i] = true; // switch direction wiperDirection[i] = true; // switch direction
} }
if (dWiperPos[i] == 0.0) if (dWiperPos[i] <= 0.0)
{ {
// when in park position // when in park position
sWiperToPark.stop(); sWiperToPark.stop();