-void
-FGTileCache::init( void )
-{
- int i;
-
- FG_LOG( FG_TERRAIN, FG_INFO, "Initializing the tile cache." );
-
- // expand cache if needed. For best results ... i.e. to avoid
- // tile load problems and blank areas:
- //
- // target_cache_size >= (current.options.tile_diameter + 1) ** 2
- //
- int side = current_options.get_tile_diameter() + 2;
- int target_cache_size = (side*side);
- FG_LOG( FG_TERRAIN, FG_DEBUG, " target cache size = "
- << target_cache_size );
- FG_LOG( FG_TERRAIN, FG_DEBUG, " current cache size = "
- << tile_cache.size() );
- FGTileEntry e;
- FG_LOG( FG_TERRAIN, FG_DEBUG, " size of tile = "
- << sizeof( e ) );
- if ( target_cache_size > (int)tile_cache.size() ) {
- // FGTileEntry e;
- e.mark_unused();
- int expansion_amt = target_cache_size - (int)tile_cache.size();
- for ( i = 0; i < expansion_amt; ++i ) {
- tile_cache.push_back( e );
- FG_LOG( FG_TERRAIN, FG_DEBUG, " expanding cache size = "
- << tile_cache.size() );
- }
- }
- FG_LOG( FG_TERRAIN, FG_DEBUG, " done expanding cache, size = "
- << tile_cache.size() );
-
- for ( i = 0; i < (int)tile_cache.size(); i++ ) {
- if ( !tile_cache[i].is_unused() ) {
- entry_free(i);
- }
- tile_cache[i].mark_unused();
- tile_cache[i].tile_bucket.make_bad();
- }
- FG_LOG( FG_TERRAIN, FG_DEBUG, " done with init()" );
+void TileCache::init( void ) {
+ SG_LOG( SG_TERRAIN, SG_INFO, "Initializing the tile cache." );
+
+ SG_LOG( SG_TERRAIN, SG_INFO, " max cache size = "
+ << max_cache_size );
+ SG_LOG( SG_TERRAIN, SG_INFO, " current cache size = "
+ << tile_cache.size() );
+
+ clear_cache();
+
+ SG_LOG( SG_TERRAIN, SG_INFO, " done with init()" );