Exemplo n.º 1
0
void DivinePantheon::initialize( const io::FilePath& filename )
{
  VariantMap pantheon = SaveAdapter::load( filename.toString() );

  _d->divinties.push_back( RomeDivinityBase::create( pantheon.get( "ceres" ).toMap() ) );
  _d->divinties.push_back( RomeDivinityBase::create( pantheon.get( "mars" ).toMap() ) );
  _d->divinties.push_back( RomeDivinityBase::create( pantheon.get( "neptune" ).toMap() ) );
  _d->divinties.push_back( RomeDivinityBase::create( pantheon.get( "venus" ).toMap() ) );
  _d->divinties.push_back( RomeDivinityBase::create( pantheon.get( "mercury" ).toMap() ) );
}
Exemplo n.º 2
0
void Game::Impl::initPictures(const io::FilePath& resourcePath)
{
  AnimationBank::loadCarts();
  AnimationBank::loadWalkers();
  
  StringHelper::debug( 0xff, "Load fonts" );
  FontCollection::instance().initialize( resourcePath.toString() );

  StringHelper::debug( 0xff, "Create runtime pictures" );
  PictureBank::instance().createResources();
}
Exemplo n.º 3
0
bool ScenarioLoader::load( const io::FilePath& filename, Scenario& scenario )
{
  // try to load file based on file extension
  Impl::LoaderIterator it = _d->loaders.begin();
  for( ; it != _d->loaders.end(); ++it)
  {
    if( (*it)->isLoadableFileExtension( filename.toString() ) /*||
        (*it)->isLoadableFileFormat(file) */ )
    {
      bool loadok = (*it)->load( filename.toString(), scenario );
      
      if( loadok )
      {
        ScenarioLoadFinalizer finalizer( scenario );
        finalizer.check();
      }

      return loadok;
    }
  }

  return false; // failed to load
}
Exemplo n.º 4
0
void BuildingDataHolder::initialize( const io::FilePath& filename )
{
  // populate _mapBuildingByInGood
  _d->mapBuildingByInGood[G_IRON]   = B_WEAPONS_WORKSHOP;
  _d->mapBuildingByInGood[G_TIMBER] = B_FURNITURE;
  _d->mapBuildingByInGood[G_CLAY]   = B_POTTERY;
  _d->mapBuildingByInGood[G_OLIVE]  = B_OIL_WORKSHOP;
  _d->mapBuildingByInGood[G_GRAPE]  = B_WINE_WORKSHOP;

  VariantMap constructions = SaveAdapter::load( filename.toString() );

  for( VariantMap::iterator it=constructions.begin(); it != constructions.end(); it++ )
  {
    VariantMap options = (*it).second.toMap();

    const BuildingType btype = getType( (*it).first );
    if( btype == B_NONE )
    {
      StringHelper::debug( 0xff, "!!!Warning: can't associate type with %s", (*it).first.c_str() );
      continue;
    }

    Impl::BuildingsMap::const_iterator bdataIt = _d->buildings.find( btype );
    if( bdataIt != _d->buildings.end() )
    {
      StringHelper::debug( 0xff, "!!!Warning: type %s also initialized", (*it).first.c_str() );
      continue;
    }

    BuildingData bData( btype, (*it).first, (int)options[ "cost" ] );
    const std::string pretty = options[ "pretty" ].toString();
    if( !pretty.empty() )
    {
      bData._prettyName = pretty;
    }

    bData._baseDesirability  = (int)options[ "desirability" ];
    bData._desirabilityRange = (int)options[ "desrange" ];
    bData._desirabilityStep  = (int)options[ "desstep" ];
    bData._employers = (int)options[ "employers" ];
    bData._buildingClass = getClass( options[ "class" ].toString() );
    bData._resourceGroup = options[ "resource" ].toString();
    bData._rcIndex = (int)options[ "rcindex" ];

    addData( bData );
  }
}
Exemplo n.º 5
0
//! returns true if the file maybe is able to be loaded by this class
//! based on the file extension (e.g. ".tga")
bool PictureLoaderPng::isALoadableFileExtension(const io::FilePath& filename) const
{
  return filename.isExtension( ".png" );
}