* Start/initialise all our engines. Must be called whenever there are changes * to the NewGRF config. */
| 796 | * to the NewGRF config. |
| 797 | */ |
| 798 | void StartupEngines() |
| 799 | { |
| 800 | /* Aging of vehicles stops, so account for that when starting late */ |
| 801 | const TimerGameCalendar::Date aging_date = std::min(TimerGameCalendar::date, TimerGameCalendar::ConvertYMDToDate(_year_engine_aging_stops, 0, 1)); |
| 802 | TimerGameCalendar::YearMonthDay aging_ymd = TimerGameCalendar::ConvertDateToYMD(aging_date); |
| 803 | uint32_t seed = Random(); |
| 804 | |
| 805 | for (Engine *e : Engine::Iterate()) { |
| 806 | StartupOneEngine(e, aging_ymd, seed); |
| 807 | } |
| 808 | for (Engine *e : Engine::Iterate()) { |
| 809 | CalcEngineReliability(e, false); |
| 810 | } |
| 811 | |
| 812 | /* Update the bitmasks for the vehicle lists */ |
| 813 | for (Company *c : Company::Iterate()) { |
| 814 | c->avail_railtypes = GetCompanyRailTypes(c->index); |
| 815 | c->avail_roadtypes = GetCompanyRoadTypes(c->index); |
| 816 | } |
| 817 | |
| 818 | /* Invalidate any open purchase lists */ |
| 819 | InvalidateWindowClassesData(WC_BUILD_VEHICLE); |
| 820 | |
| 821 | SetWindowClassesDirty(WC_BUILD_VEHICLE); |
| 822 | SetWindowClassesDirty(WC_REPLACE_VEHICLE); |
| 823 | } |
| 824 | |
| 825 | /** |
| 826 | * Allows engine \a eid to be used by a company \a company. |
no test coverage detected