diff options
Diffstat (limited to 'src/vehicle.cpp')
-rw-r--r-- | src/vehicle.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp index 864b971cc..575f5a3a3 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -986,13 +986,18 @@ void CheckVehicleBreakdown(Vehicle *v) } } -void Vehicle::HandleBreakdown() +bool Vehicle::HandleBreakdown() { /* Possible states for Vehicle::breakdown_ctr * 0 - vehicle is running normally * 1 - vehicle is currently broken down * 2 - vehicle is going to break down now * >2 - vehicle is counting down to the actual breakdown event */ + if (this->breakdown_ctr == 0) return false; + if (this->breakdown_ctr > 2) { + if (!this->current_order.IsType(OT_LOADING)) this->breakdown_ctr--; + return false; + } if (this->breakdown_ctr != 1) { this->breakdown_ctr = 1; @@ -1024,7 +1029,7 @@ void Vehicle::HandleBreakdown() } /* Aircraft breakdowns end only when arriving at the airport */ - if (this->type == VEH_AIRCRAFT) return; + if (this->type == VEH_AIRCRAFT) return false; /* For trains this function is called twice per tick, so decrease v->breakdown_delay at half the rate */ if ((this->tick_counter & (this->type == VEH_TRAIN ? 3 : 1)) == 0) { @@ -1034,6 +1039,7 @@ void Vehicle::HandleBreakdown() SetWindowDirty(WC_VEHICLE_VIEW, this->index); } } + return true; } void AgeVehicle(Vehicle *v) |