void WorkersHire::timeStep( const unsigned int time ) { if( !game::Date::isWeekChanged() ) return; if( _city()->states().population == 0 ) return; _d->recrutesInCity = _city()->statistic().walkers .find( walker::recruter ) .select<Recruter>(); WorkingBuildingList buildings = _city()->statistic().objects .find<WorkingBuilding>(); if( !_d->priorities.empty() ) { for( auto& priority : _d->priorities ) { object::Groups groups = industry::toGroups( priority ); for( auto group : groups ) { for( WorkingBuildingList::iterator it=buildings.begin(); it != buildings.end(); ) { if( (*it)->group() == group ) { _d->hireWorkers( _city(), *it ); it = buildings.erase( it ); } else { ++it; } } } } } for( auto building : buildings ) { _d->hireWorkers( _city(), building ); } if( _d->lastMessageDate.monthsTo( game::Date::current() ) > DateTime::monthsInYear / 2 ) { _d->lastMessageDate = game::Date::current(); int workersNeed = _city()->statistic().workers.need(); if( workersNeed > employements::needMoreWorkers ) { GameEventPtr e = ShowInfobox::create( _("##city_need_workers_title##"), _("##city_need_workers_text##"), ShowInfobox::send2scribe ); e->dispatch(); } } }
AdvisorEmployerWindow::Impl::EmployersInfo AdvisorEmployerWindow::Impl::getEmployersInfo( PriorityIndex type ) { std::vector< TileOverlayGroup > bldClasses; switch( type ) { case prIndustryAndTrade: bldClasses.push_back( BC_INDUSTRY ); bldClasses.push_back( BC_TRADE ); break; case prFood: bldClasses.push_back( BC_FOOD ); break; case prEngineers: bldClasses.push_back( BC_ENGINEERING ); break; case prWater: bldClasses.push_back( BC_WATER ); break; case prPrefectures: bldClasses.push_back( BC_SECURITY ); break; case prMilitary: bldClasses.push_back( BC_MILITARY ); break; case prEntertainment: bldClasses.push_back( BC_ENTERTAINMENT ); break; case prHealthAndEducation: bldClasses.push_back( BC_HEALTH ); bldClasses.push_back( BC_EDUCATUION ); break; case prAdministrationAndReligion: bldClasses.push_back( BC_ADMINISTRATION ); bldClasses.push_back( BC_RELIGION ); break; default: break; } WorkingBuildingList buildings; CityHelper helper( city ); foreach( TileOverlayGroup cl, bldClasses ) { WorkingBuildingList sectorBuildings = helper.find<WorkingBuilding>( cl ); buildings.insert( buildings.begin(), sectorBuildings.begin(), sectorBuildings.end() ); }