Track time in TileCache; assign new tiles the current time

This commit is contained in:
timoore
2008-11-24 22:08:31 +00:00
parent 8303e30033
commit bad80521a8
2 changed files with 7 additions and 1 deletions

View File

@@ -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;
}

View File

@@ -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; }
};
}