Пример #1
0
void Game::Impl::mountArchives(ResourceLoader &loader)
{
    Logger::warning( "Game: mount archives begin" );

    std::string errorStr;
    std::string c3res = SETTINGS_STR( c3gfx );
    if( !c3res.empty() )
    {
        vfs::Directory gfxDir( c3res );
        vfs::Path c3sg2( "c3.sg2" );
        vfs::Path c3path = gfxDir/c3sg2;

        if( !c3path.exist( vfs::Path::ignoreCase ) )
        {
            errorStr = "This game use resources files (.sg2, .map) from Caesar III(c), but "
                       "original game archive c3.sg2 not found in folder " + c3res +
                       "!!!.\nBe sure that you copy all .sg2, .map and .smk files placed to resource folder";
            SETTINGS_SET_VALUE( c3gfx, std::string( "" ) );
            game::Settings::save();
        }

        loader.loadFromModel( SETTINGS_RC_PATH( sg2model ), gfxDir );
        engine->setFlag( Engine::batching, false );
    }
    else
    {
        vfs::Path testPics = SETTINGS_RC_PATH( picsArchive );
        if( !testPics.exist() )
        {
            SETTINGS_SET_VALUE( resourcePath, Variant("") );
            errorStr = "Not found graphics package. Use precompiled CaesarIA archive or use\n"
                       "-c3gfx flag to set absolute path to Caesar III(r) installation folder,\n"
                       "forexample, \"-c3gfx c:/games/caesar3/\"";
        }

        loader.loadFromModel( SETTINGS_RC_PATH( remakeModel ) );
    }

    if( !errorStr.empty() )
    {
        OSystem::error( "Resources error", errorStr );
        Logger::warning( "CRITICAL: not found original resources in " + c3res );
        exit( -1 ); //kill application
    }

    loader.loadFromModel( SETTINGS_RC_PATH( archivesModel ) );
}