]> git.mxchange.org Git - flightgear.git/blobdiff - src/Scenery/tilecache.cxx
AircraftModel hacking for package support.
[flightgear.git] / src / Scenery / tilecache.cxx
index bdec44d3b693a0b3b213104d93bcb2d3e8efc765..6ff8dd8319c3d0d2f200a5c10867001a3152d614 100644 (file)
@@ -38,8 +38,14 @@ TileCache::TileCache( void ) :
 }
 
 
-TileCache::~TileCache( void ) {
-    clear_cache();
+TileCache::~TileCache( void )
+{
+    tile_map_iterator it = tile_cache.begin();
+    for (; it != tile_cache.end(); ++it) {
+        TileEntry* tile = it->second;
+        tile->removeFromSceneGraph();
+        delete tile;
+    }
 }
 
 
@@ -121,6 +127,22 @@ long TileCache::get_drop_tile() {
     return min_index;
 }
 
+long TileCache::get_first_expired_tile() const
+{
+  const_tile_map_iterator current = tile_cache.begin();
+  const_tile_map_iterator end = tile_cache.end();
+  
+  for ( ; current != end; ++current ) {
+    TileEntry *e = current->second;
+    if (!e->is_current_view() && e->is_expired(current_time))
+    {
+      return current->first;
+    }
+  }
+  
+  return -1; // no expired tile found
+}
+
 
 // Clear all flags indicating tiles belonging to the current view
 void TileCache::clear_current_view()
@@ -154,7 +176,6 @@ void TileCache::clear_cache() {
 
     for ( ; current != end; ++current ) {
         long index = current->first;
-        SG_LOG( SG_TERRAIN, SG_DEBUG, "clearing " << index );
         TileEntry *e = current->second;
         if ( e->is_loaded() ) {
             e->tile_bucket.make_bad();