summaryrefslogtreecommitdiff
path: root/src/map.cpp
diff options
context:
space:
mode:
authorkwolekr <kwolekr@minetest.net>2013-06-25 11:49:08 -0400
committerkwolekr <kwolekr@minetest.net>2013-06-27 22:35:35 -0400
commit2c0b51795e6fa6747d881f1871c89830abb6e6e8 (patch)
treef14014ac3aeaeca01b941e9acd6e45bfc7527e98 /src/map.cpp
parentd6ac3d8d9a6484f2d348d1caea203de0069b6bd6 (diff)
downloadminetest-2c0b51795e6fa6747d881f1871c89830abb6e6e8.tar.gz
minetest-2c0b51795e6fa6747d881f1871c89830abb6e6e8.tar.bz2
minetest-2c0b51795e6fa6747d881f1871c89830abb6e6e8.zip
Fix issue of VManip occasionally not blitting back blocks, and pitch black lighting bug
Diffstat (limited to 'src/map.cpp')
-rw-r--r--src/map.cpp38
1 files changed, 24 insertions, 14 deletions
diff --git a/src/map.cpp b/src/map.cpp
index 001ae1609..cf7dd6f9f 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -2596,7 +2596,7 @@ bool ServerMap::initBlockMake(BlockMakeData *data, v3s16 blockpos)
// Add the area
{
//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
@@ -4202,8 +4202,8 @@ void ManualMapVoxelManipulator::emerge(VoxelArea a, s32 caller_id)
VoxelManipulator::emerge(a, caller_id);
}
-void ManualMapVoxelManipulator::initialEmerge(
- v3s16 blockpos_min, v3s16 blockpos_max)
+void ManualMapVoxelManipulator::initialEmerge(v3s16 blockpos_min,
+ v3s16 blockpos_max, bool load_if_inexistent)
{
TimeTaker timer1("initialEmerge", &emerge_time);
@@ -4255,18 +4255,28 @@ void ManualMapVoxelManipulator::initialEmerge(
if(block_data_inexistent)
{
- flags |= VMANIP_BLOCK_DATA_INEXIST;
- /*
- Mark area inexistent
- */
- VoxelArea a(p*MAP_BLOCKSIZE, (p+1)*MAP_BLOCKSIZE-v3s16(1,1,1));
- // Fill with VOXELFLAG_INEXISTENT
- 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_INEXISTENT, MAP_BLOCKSIZE);
+ 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;
+
+ /*
+ Mark area inexistent
+ */
+ VoxelArea a(p*MAP_BLOCKSIZE, (p+1)*MAP_BLOCKSIZE-v3s16(1,1,1));
+ // Fill with VOXELFLAG_INEXISTENT
+ 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_INEXISTENT, MAP_BLOCKSIZE);
+ }
}
}
/*else if (block->getNode(0, 0, 0).getContent() == CONTENT_IGNORE)