diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2011-07-03 15:26:40 +0200 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2011-07-03 15:26:40 +0200 |
commit | e95b3cb3e1a054a9d6bd766d4904e569ac2b2a68 (patch) | |
tree | 2c2c0dea65fa57232c5d9377d4e53bf7001fbe06 /terrain_cache.cpp | |
parent | 6e746716d6a5c72fbd42539c6d5d92da8830cb9e (diff) |
Diffstat (limited to 'terrain_cache.cpp')
-rw-r--r-- | terrain_cache.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/terrain_cache.cpp b/terrain_cache.cpp index 01cc161..f0f757b 100644 --- a/terrain_cache.cpp +++ b/terrain_cache.cpp @@ -2,20 +2,28 @@ /* TerrainCacheObject */ -TerrainCacheObject::TerrainCacheObject(TerrainCache *cache, int64_t x, int64_t y, unsigned int width, unsigned int height, float *heights) { +TerrainCacheObject::TerrainCacheObject(TerrainCache *cache, int64_t x, int64_t y, unsigned int width, unsigned int height, + float *heights, std::list<Vector3> *objects) { this->cache = cache; this->x = x; this->y = y; this->width = width; this->height = height; + if(heights) this->heights = heights; else this->heights = cache->tl->get_chunk(x, y, width, height); + + if(objects) + this->objects.insert(this->objects.end(), objects->begin(), objects->end()); + else + this->objects = cache->tl->get_objects(x, y); } TerrainCacheObject::~TerrainCacheObject() { cache->tl->save_chunk(heights, x, y, width, height); + cache->tl->save_objects(objects, x, y); delete[] heights; } |