* Service a vehicle and all subsequent vehicles in the consist * * @param *v The vehicle or vehicle chain being serviced */
| 176 | * @param *v The vehicle or vehicle chain being serviced |
| 177 | */ |
| 178 | void VehicleServiceInDepot(Vehicle *v) |
| 179 | { |
| 180 | assert(v != nullptr); |
| 181 | SetWindowDirty(WC_VEHICLE_DETAILS, v->index); // ensure that last service date and reliability are updated |
| 182 | |
| 183 | do { |
| 184 | v->date_of_last_service = TimerGameEconomy::date; |
| 185 | v->date_of_last_service_newgrf = TimerGameCalendar::date; |
| 186 | v->breakdowns_since_last_service = 0; |
| 187 | v->reliability = v->GetEngine()->reliability; |
| 188 | /* Prevent vehicles from breaking down directly after exiting the depot. */ |
| 189 | v->breakdown_chance /= 4; |
| 190 | if (_settings_game.difficulty.vehicle_breakdowns == 1) v->breakdown_chance = 0; // on reduced breakdown |
| 191 | v = v->Next(); |
| 192 | } while (v != nullptr && v->HasEngineType()); |
| 193 | } |
| 194 | |
| 195 | /** |
| 196 | * Check if the vehicle needs to go to a depot in near future (if a opportunity presents itself) for service or replacement. |
no test coverage detected