Fixed Bridge

This commit is contained in:
guard3 2019-07-17 23:05:11 +03:00
parent 94fb33b60c
commit dbe205ad08

View File

@ -46,6 +46,7 @@ void CBridge::Update()
float liftHeight; float liftHeight;
// Set bridge height and state
if (CStats::CommercialPassed) if (CStats::CommercialPassed)
{ {
if (TimeOfBridgeBecomingOperational == 0) if (TimeOfBridgeBecomingOperational == 0)
@ -81,6 +82,13 @@ void CBridge::Update()
liftHeight = 25.0; liftHeight = 25.0;
State = STATE_LIFT_PART_IS_UP; State = STATE_LIFT_PART_IS_UP;
} }
}
else
{
liftHeight = 25.0;
TimeOfBridgeBecomingOperational = 0;
State = STATE_BRIDGE_LOCKED;
}
// Move bridge part // Move bridge part
if (liftHeight != OldLift) if (liftHeight != OldLift)
@ -105,13 +113,6 @@ void CBridge::Update()
ThePaths.SetLinksBridgeLights(-330.0, -230.0, -700.0, -588.0, true); ThePaths.SetLinksBridgeLights(-330.0, -230.0, -700.0, -588.0, true);
else if (State == STATE_LIFT_PART_IS_DOWN && OldState == STATE_LIFT_PART_MOVING_DOWN) else if (State == STATE_LIFT_PART_IS_DOWN && OldState == STATE_LIFT_PART_MOVING_DOWN)
ThePaths.SetLinksBridgeLights(-330.0, -230.0, -700.0, -588.0, false); ThePaths.SetLinksBridgeLights(-330.0, -230.0, -700.0, -588.0, false);
}
else
{
liftHeight = 25.0;
TimeOfBridgeBecomingOperational = 0;
State = STATE_BRIDGE_LOCKED;
}
} }
bool CBridge::ShouldLightsBeFlashing() { return State != STATE_LIFT_PART_IS_DOWN; } bool CBridge::ShouldLightsBeFlashing() { return State != STATE_LIFT_PART_IS_DOWN; }