Added check on negative speed

This commit is contained in:
Pax1601 2023-12-05 09:22:22 +01:00
parent 87d71da55e
commit 82704f042b

View File

@ -44,6 +44,9 @@ void Helicopter::changeSpeed(string change)
setDesiredSpeed(getDesiredSpeed() - knotsToMs(10));
else if (change.compare("fast") == 0)
setDesiredSpeed(getDesiredSpeed() + knotsToMs(10));
if (getDesiredSpeed() < knotsToMs(0))
setDesiredSpeed(knotsToMs(0));
}
void Helicopter::changeAltitude(string change)