Fix issue of VManip occasionally not blitting back blocks, and pitch black lighting bug

This commit is contained in:
kwolekr 2013-06-25 11:49:08 -04:00
parent d6ac3d8d9a
commit 2c0b51795e
2 changed files with 26 additions and 15 deletions

@ -2596,7 +2596,7 @@ bool ServerMap::initBlockMake(BlockMakeData *data, v3s16 blockpos)
// Add the area // Add the area
{ {
//TimeTaker timer("initBlockMake() initialEmerge"); //TimeTaker timer("initBlockMake() initialEmerge");
data->vmanip->initialEmerge(bigarea_blocks_min, bigarea_blocks_max); data->vmanip->initialEmerge(bigarea_blocks_min, bigarea_blocks_max, false);
} }
// Ensure none of the blocks to be generated were marked as containing CONTENT_IGNORE // Ensure none of the blocks to be generated were marked as containing CONTENT_IGNORE
@ -4202,8 +4202,8 @@ void ManualMapVoxelManipulator::emerge(VoxelArea a, s32 caller_id)
VoxelManipulator::emerge(a, caller_id); VoxelManipulator::emerge(a, caller_id);
} }
void ManualMapVoxelManipulator::initialEmerge( void ManualMapVoxelManipulator::initialEmerge(v3s16 blockpos_min,
v3s16 blockpos_min, v3s16 blockpos_max) v3s16 blockpos_max, bool load_if_inexistent)
{ {
TimeTaker timer1("initialEmerge", &emerge_time); TimeTaker timer1("initialEmerge", &emerge_time);
@ -4255,6 +4255,15 @@ void ManualMapVoxelManipulator::initialEmerge(
if(block_data_inexistent) if(block_data_inexistent)
{ {
if (load_if_inexistent) {
ServerMap *svrmap = (ServerMap *)m_map;
block = svrmap->emergeBlock(p, false);
if (block == NULL)
block = svrmap->createBlock(p);
else
block->copyTo(*this);
} else {
flags |= VMANIP_BLOCK_DATA_INEXIST; flags |= VMANIP_BLOCK_DATA_INEXIST;
/* /*
@ -4269,6 +4278,7 @@ void ManualMapVoxelManipulator::initialEmerge(
memset(&m_flags[i], VOXELFLAG_INEXISTENT, MAP_BLOCKSIZE); memset(&m_flags[i], VOXELFLAG_INEXISTENT, MAP_BLOCKSIZE);
} }
} }
}
/*else if (block->getNode(0, 0, 0).getContent() == CONTENT_IGNORE) /*else if (block->getNode(0, 0, 0).getContent() == CONTENT_IGNORE)
{ {
// Mark that block was loaded as blank // Mark that block was loaded as blank

@ -555,7 +555,8 @@ public:
virtual void emerge(VoxelArea a, s32 caller_id=-1); virtual void emerge(VoxelArea a, s32 caller_id=-1);
void initialEmerge(v3s16 blockpos_min, v3s16 blockpos_max); void initialEmerge(v3s16 blockpos_min, v3s16 blockpos_max,
bool load_if_inexistent = true);
// This is much faster with big chunks of generated data // This is much faster with big chunks of generated data
void blitBackAll(std::map<v3s16, MapBlock*> * modified_blocks); void blitBackAll(std::map<v3s16, MapBlock*> * modified_blocks);