From: timoore Date: Mon, 24 Nov 2008 22:08:31 +0000 (+0000) Subject: Track time in TileCache; assign new tiles the current time X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=bad80521a846818e29a862d2824cf0cd21870c35;p=simgear.git Track time in TileCache; assign new tiles the current time --- diff --git a/simgear/scene/tgdb/TileCache.cxx b/simgear/scene/tgdb/TileCache.cxx index 4f0b8e3b..106dd054 100644 --- a/simgear/scene/tgdb/TileCache.cxx +++ b/simgear/scene/tgdb/TileCache.cxx @@ -35,7 +35,7 @@ using simgear::TileEntry; using simgear::TileCache; TileCache::TileCache( void ) : - max_cache_size(100) + max_cache_size(100), current_time(0.0) { tile_cache.clear(); } @@ -167,6 +167,7 @@ bool TileCache::insert_tile( TileEntry *e ) { // register tile in the cache long tile_index = e->get_tile_bucket().gen_index(); tile_cache[tile_index] = e; + e->set_timestamp(current_time); return true; } diff --git a/simgear/scene/tgdb/TileCache.hxx b/simgear/scene/tgdb/TileCache.hxx index f3c8a582..f141507d 100644 --- a/simgear/scene/tgdb/TileCache.hxx +++ b/simgear/scene/tgdb/TileCache.hxx @@ -53,6 +53,8 @@ private: // Free a tile cache entry void entry_free( long cache_index ); + double current_time; + public: tile_map_iterator begin() { return tile_cache.begin(); } tile_map_iterator end() { return tile_cache.end(); } @@ -122,6 +124,9 @@ public: * @return success/failure */ bool insert_tile( simgear::TileEntry* e ); + + void set_current_time(double val) { current_time = val; } + double get_current_time() const { return current_time; } }; }