Exemplo n.º 1
0
void Services::initialize(PlayerCityPtr city, const std::string& model)
{
  VariantMap services = config::load( model );

  for (auto it : services)
  {
    SrvcPtr service = ServiceFactory::instance().create( city, it.first );
    if( service.isValid() )
      city->addService( service );
    else
      Logger::warning( "!!! WARNING: Cant initialize service %s on city create", it.first.c_str() );
  }
}
Exemplo n.º 2
0
void PostponeEvent::Impl::executeCityService( Game& game, const std::string& type, bool& r )
{
  PlayerCityPtr city = game.city();
  std::string dtype = options.get( "type", Variant( type ) ).toString();
  city::SrvcPtr srvc = city::ServiceFactory::create( game.city(), dtype );
  if( srvc.isValid() )
  {
    srvc->load( options );
    city->addService( srvc );
    r = true;
    return;
  }

  r = false;
}