X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FScenery%2Fnewcache.hxx;h=0afbb9b39ea79d8c907e53c0d24694f3ceb7a3d7;hb=938d006188e70e891bc04e91610c7b8caaca87b6;hp=20272b9832f0b60d49b16f3c48615a399b07eee4;hpb=95d6d93bed500dd2548dd1ee75d5693ee46accde;p=flightgear.git diff --git a/src/Scenery/newcache.hxx b/src/Scenery/newcache.hxx index 20272b983..0afbb9b39 100644 --- a/src/Scenery/newcache.hxx +++ b/src/Scenery/newcache.hxx @@ -47,17 +47,15 @@ #include "tileentry.hxx" -FG_USING_STD(map); - - -typedef map < long, FGTileEntry * > tile_map; -typedef tile_map::iterator tile_map_iterator; -typedef tile_map::const_iterator const_tile_map_iterator; - +SG_USING_STD(map); // A class to store and manage a pile of tiles class FGNewCache { + typedef map < long, FGTileEntry * > tile_map; + typedef tile_map::iterator tile_map_iterator; + typedef tile_map::const_iterator const_tile_map_iterator; + // cache storage space tile_map tile_cache; @@ -68,27 +66,30 @@ class FGNewCache { tile_map_iterator current; // Free a tile cache entry - void FGNewCache::entry_free( long cache_index ); + void entry_free( long cache_index ); public: // Constructor - FGNewCache( void ); + FGNewCache(); // Destructor - ~FGNewCache( void ); + ~FGNewCache(); // Initialize the tile cache subsystem void init( void ); // Check if the specified "bucket" exists in the cache - bool exists( const SGBucket& b ); + bool exists( const SGBucket& b ) const; // Ensure at least one entry is free in the cache - void FGNewCache::make_space(); + bool make_space(); + + // Clear all completely loaded tiles (ignores partially loaded tiles) + void clear_cache(); // Fill in a tile cache entry with real data for the specified bucket - void fill_in( const SGBucket& b ); + // void fill_in( const SGBucket& b ); // Return a pointer to the specified tile cache entry inline FGTileEntry *get_tile( const long tile_index ) { @@ -119,11 +120,14 @@ public: inline int get_max_cache_size() const { return max_cache_size; } inline void set_max_cache_size( int m ) { max_cache_size = m; } -}; - -// the tile cache -extern FGNewCache global_tile_cache; + /** + * Create a new tile and enqueue it for loading. + * @param b + * @return success/failure + */ + bool insert_tile( FGTileEntry* e ); +}; #endif // _NEWCACHE_HXX