-
- // This is used to remove a dummy from the sector while generating it.
- // Block is only removed from internal container, not deleted.
- void removeBlock(MapBlock *block);
-
- /*
- This might not be a thread-safe depending on the day.
- See the implementation.
- */
- void getBlocks(core::list<MapBlock*> &dest);
-
- /*
- If all nodes in area can be accessed, returns true and
- adds all blocks in area to blocks.
-
- If all nodes in area cannot be accessed, returns false.
-
- The implementation of this is quite slow
-
- if blocks==NULL; it is not accessed at all.
- */
- bool isValidArea(v3s16 p_min_nodes, v3s16 p_max_nodes,
- core::map<s16, MapBlock*> *blocks)
- {
- core::map<s16, MapBlock*> bs;
-
- v3s16 p_min = getNodeBlockPos(p_min_nodes);
- v3s16 p_max = getNodeBlockPos(p_max_nodes);
- if(p_min.X != 0 || p_min.Z != 0
- || p_max.X != 0 || p_max.Z != 0)
- return false;
- v3s16 y;
- for(s16 y=p_min.Y; y<=p_max.Y; y++)
- {
- try{
- MapBlock *block = getBlockNoCreate(y);
- if(block->isDummy())
- return false;
- if(blocks!=NULL)
- bs[y] = block;
- }
- catch(InvalidPositionException &e)
- {
- return false;
- }
- }
-
- if(blocks!=NULL)
- {
- for(core::map<s16, MapBlock*>::Iterator i=bs.getIterator();
- i.atEnd()==false; i++)
- {
- MapBlock *block = i.getNode()->getValue();
- s16 y = i.getNode()->getKey();
- blocks->insert(y, block);
- }
- }
- return true;
- }
-
- void getBlocksInArea(v3s16 p_min_nodes, v3s16 p_max_nodes,
- core::map<v3s16, MapBlock*> &blocks)
- {
- v3s16 p_min = getNodeBlockPos(p_min_nodes);
- v3s16 p_max = getNodeBlockPos(p_max_nodes);
- v3s16 y;
- for(s16 y=p_min.Y; y<=p_max.Y; y++)
- {
- try{
- MapBlock *block = getBlockNoCreate(y);
- blocks.insert(block->getPos(), block);
- }
- catch(InvalidPositionException &e)
- {
- }
- }
- }
-
- // virtual from NodeContainer
- bool isValidPosition(v3s16 p)
- {
- v3s16 blockpos = getNodeBlockPos(p);
-
- if(blockpos.X != 0 || blockpos.Z != 0)
- return false;
-
- MapBlock *blockref;
- try{
- blockref = getBlockNoCreate(blockpos.Y);
- }
- catch(InvalidPositionException &e)
- {
- return false;
- }