From: sapier Date: Mon, 9 Jun 2014 12:25:35 +0000 (+0200) Subject: Remove MapVoxelManipulator not really used by anyone X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=b3a2ef1a911b5ee22ff6478b5a3f9a12f6e40121;p=zefram%2Fminetest%2Fminetest_engine.git Remove MapVoxelManipulator not really used by anyone --- diff --git a/src/map.cpp b/src/map.cpp index 814eea4c..35bd485a 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -3484,167 +3484,10 @@ void ServerMap::PrintInfo(std::ostream &out) out<<"ServerMap: "; } -/* - MapVoxelManipulator -*/ - -MapVoxelManipulator::MapVoxelManipulator(Map *map) -{ - m_map = map; -} - -MapVoxelManipulator::~MapVoxelManipulator() -{ - /*infostream<<"MapVoxelManipulator: blocks: "<::iterator n; - n = m_loaded_blocks.find(p); - if(n != m_loaded_blocks.end()) - continue; - - bool block_data_inexistent = false; - try - { - TimeTaker timer1("emerge load", &emerge_load_time); - - /*infostream<<"Loading block (caller_id="<getBlockNoCreate(p); - if(block->isDummy()) - block_data_inexistent = true; - else - block->copyTo(*this); - } - catch(InvalidPositionException &e) - { - block_data_inexistent = true; - } - - if(block_data_inexistent) - { - flags |= VMANIP_BLOCK_DATA_INEXIST; - - VoxelArea a(p*MAP_BLOCKSIZE, (p+1)*MAP_BLOCKSIZE-v3s16(1,1,1)); - // Fill with VOXELFLAG_NO_DATA - for(s32 z=a.MinEdge.Z; z<=a.MaxEdge.Z; z++) - for(s32 y=a.MinEdge.Y; y<=a.MaxEdge.Y; y++) - { - s32 i = m_area.index(a.MinEdge.X,y,z); - memset(&m_flags[i], VOXELFLAG_NO_DATA, MAP_BLOCKSIZE); - } - } - /*else if (block->getNode(0, 0, 0).getContent() == CONTENT_IGNORE) - { - // Mark that block was loaded as blank - flags |= VMANIP_BLOCK_CONTAINS_CIGNORE; - }*/ - - m_loaded_blocks[p] = flags; - } - - //infostream<<"emerge done"< & modified_blocks) -{ - if(m_area.getExtent() == v3s16(0,0,0)) - return; - - //TimeTaker timer1("blitBack"); - - /*infostream<<"blitBack(): m_loaded_blocks.size()=" - <getBlockNoCreate(blockpos); - blockpos_last = blockpos; - block_checked_in_modified = false; - } - - // Calculate relative position in block - v3s16 relpos = p - blockpos * MAP_BLOCKSIZE; - - // Don't continue if nothing has changed here - if(block->getNode(relpos) == n) - continue; - - //m_map->setNode(m_area.MinEdge + p, n); - block->setNode(relpos, n); - - /* - Make sure block is in modified_blocks - */ - if(block_checked_in_modified == false) - { - modified_blocks[blockpos] = block; - block_checked_in_modified = true; - } - } - catch(InvalidPositionException &e) - { - } - } -} - ManualMapVoxelManipulator::ManualMapVoxelManipulator(Map *map): - MapVoxelManipulator(map), - m_create_area(false) + VoxelManipulator(), + m_create_area(false), + m_map(map) { } @@ -3652,12 +3495,6 @@ ManualMapVoxelManipulator::~ManualMapVoxelManipulator() { } -void ManualMapVoxelManipulator::emerge(VoxelArea a, s32 caller_id) -{ - // Just create the area so that it can be pointed to - VoxelManipulator::addArea(a); -} - void ManualMapVoxelManipulator::initialEmerge(v3s16 blockpos_min, v3s16 blockpos_max, bool load_if_inexistent) { diff --git a/src/map.h b/src/map.h index 46580ed3..7f482929 100644 --- a/src/map.h +++ b/src/map.h @@ -523,14 +523,15 @@ private: Database *dbase; }; + #define VMANIP_BLOCK_DATA_INEXIST 1 #define VMANIP_BLOCK_CONTAINS_CIGNORE 2 -class MapVoxelManipulator : public VoxelManipulator +class ManualMapVoxelManipulator : public VoxelManipulator { public: - MapVoxelManipulator(Map *map); - virtual ~MapVoxelManipulator(); + ManualMapVoxelManipulator(Map *map); + virtual ~ManualMapVoxelManipulator(); virtual void clear() { @@ -538,30 +539,9 @@ public: m_loaded_blocks.clear(); } - virtual void emerge(VoxelArea a, s32 caller_id=-1); - - void blitBack(std::map & modified_blocks); - -protected: - Map *m_map; - /* - key = blockpos - value = flags describing the block - */ - std::map m_loaded_blocks; -}; - -class ManualMapVoxelManipulator : public MapVoxelManipulator -{ -public: - ManualMapVoxelManipulator(Map *map); - virtual ~ManualMapVoxelManipulator(); - void setMap(Map *map) {m_map = map;} - virtual void emerge(VoxelArea a, s32 caller_id=-1); - void initialEmerge(v3s16 blockpos_min, v3s16 blockpos_max, bool load_if_inexistent = true); @@ -570,6 +550,12 @@ public: protected: bool m_create_area; + Map *m_map; + /* + key = blockpos + value = flags describing the block + */ + std::map m_loaded_blocks; }; #endif