Economy day handler */
| 452 | |
| 453 | /** Economy day handler */ |
| 454 | void Aircraft::OnNewEconomyDay() |
| 455 | { |
| 456 | if (!this->IsNormalAircraft()) return; |
| 457 | EconomyAgeVehicle(this); |
| 458 | |
| 459 | if ((++this->day_counter & 7) == 0) DecreaseVehicleValue(this); |
| 460 | |
| 461 | CheckOrders(this); |
| 462 | |
| 463 | CheckVehicleBreakdown(this); |
| 464 | CheckIfAircraftNeedsService(this); |
| 465 | |
| 466 | if (this->running_ticks == 0) return; |
| 467 | |
| 468 | CommandCost cost(EXPENSES_AIRCRAFT_RUN, this->GetRunningCost() * this->running_ticks / (CalendarTime::DAYS_IN_YEAR * Ticks::DAY_TICKS)); |
| 469 | |
| 470 | this->profit_this_year -= cost.GetCost(); |
| 471 | this->running_ticks = 0; |
| 472 | |
| 473 | SubtractMoneyFromCompanyFract(this->owner, cost); |
| 474 | |
| 475 | SetWindowDirty(WC_VEHICLE_DETAILS, this->index); |
| 476 | SetWindowClassesDirty(WC_AIRCRAFT_LIST); |
| 477 | } |
| 478 | |
| 479 | static void HelicopterTickHandler(Aircraft *v) |
| 480 | { |
nothing calls this directly
no test coverage detected