- // Return a pointer to the specified tile cache entry
- FGTileEntry *get_tile( int index ) {
- return &tile_cache[index];
+ // Initialize the tile cache subsystem
+ void init( void );
+
+ // Check if the specified "bucket" exists in the cache
+ bool exists( const SGBucket& b ) const;
+
+ // Return the index of a tile to be dropped from the cache, return -1 if
+ // nothing available to be removed.
+ long get_drop_tile();
+
+ // Clear all flags indicating tiles belonging to the current view
+ void clear_current_view();
+
+ // Clear a cache entry, note that the cache only holds pointers
+ // and this does not free the object which is pointed to.
+ void clear_entry( long cache_entry );
+
+ // Refresh/reload a tile when it's already in memory.
+ void refresh_tile(long tile_index);
+
+ // Clear all completely loaded tiles (ignores partially loaded tiles)
+ void clear_cache();
+
+ // Return a pointer to the specified tile cache entry
+ inline TileEntry *get_tile( const long tile_index ) const {
+ const_tile_map_iterator it = tile_cache.find( tile_index );
+ if ( it != tile_cache.end() ) {
+ return it->second;
+ } else {
+ return NULL;
+ }
+ }
+
+ // Return a pointer to the specified tile cache entry
+ inline TileEntry *get_tile( const SGBucket& b ) const {
+ return get_tile( b.gen_index() );