Index: src/engine.cpp =================================================================== --- src/engine.cpp (revision 27699) +++ src/engine.cpp (working copy) @@ -48,11 +48,6 @@ */ static Year _year_engine_aging_stops; -/** - * The railtypes that have been or never will be introduced, or - * an inverse bitmap of rail types that have to be introduced. */ -static uint16 _introduced_railtypes; - /** Number of engines of each vehicle type in original engine data */ const uint8 _engine_counts[4] = { lengthof(_orig_rail_vehicle_info), @@ -543,31 +538,8 @@ const Engine *e = new Engine(eid->type, eid->internal_id); assert(e->index == index); } - - _introduced_railtypes = 0; } -/** - * Check whether the railtypes should be introduced. - */ -static void CheckRailIntroduction() -{ - /* All railtypes have been introduced. */ - if (_introduced_railtypes == UINT16_MAX || Company::GetPoolSize() == 0) return; - - /* We need to find the railtypes that are known to all companies. */ - RailTypes rts = (RailTypes)UINT16_MAX; - - /* We are at, or past the introduction date of the rail. */ - Company *c; - FOR_ALL_COMPANIES(c) { - c->avail_railtypes = AddDateIntroducedRailTypes(c->avail_railtypes, _date); - rts &= c->avail_railtypes; - } - - _introduced_railtypes |= rts; -} - void ShowEnginePreviewWindow(EngineID engine); /** @@ -711,19 +683,6 @@ c->avail_roadtypes = GetCompanyRoadtypes(c->index); } - /* Rail types that are invalid or never introduced are marked as - * being introduced upon start. That way we can easily check whether - * there is any date related introduction that is still going to - * happen somewhere in the future. */ - for (RailType rt = RAILTYPE_BEGIN; rt != RAILTYPE_END; rt++) { - const RailtypeInfo *rti = GetRailTypeInfo(rt); - if (rti->label != 0 && IsInsideMM(rti->introduction_date, 0, MAX_DAY)) continue; - - SetBit(_introduced_railtypes, rt); - } - - CheckRailIntroduction(); - /* Invalidate any open purchase lists */ InvalidateWindowClassesData(WC_BUILD_VEHICLE); } @@ -820,7 +779,10 @@ /** Daily check to offer an exclusive engine preview to the companies. */ void EnginesDailyLoop() { - CheckRailIntroduction(); + Company *c; + FOR_ALL_COMPANIES(c) { + c->avail_railtypes = AddDateIntroducedRailTypes(c->avail_railtypes, _date); + } if (_cur_year >= _year_engine_aging_stops) return;