diff options
author | kwolekr <kwolekr@minetest.net> | 2014-09-01 14:20:31 -0400 |
---|---|---|
committer | kwolekr <kwolekr@minetest.net> | 2014-09-01 15:12:22 -0400 |
commit | 9e4e7072da8f565eef37da7558053a436b9cbba3 (patch) | |
tree | d1bb4ac82b4a25880695aec4df163dd0002cd526 /src/map.cpp | |
parent | 3fa4f782d90dac0d800251a9ab0f0afb9d32560c (diff) | |
download | minetest-9e4e7072da8f565eef37da7558053a436b9cbba3.tar.gz minetest-9e4e7072da8f565eef37da7558053a436b9cbba3.tar.bz2 minetest-9e4e7072da8f565eef37da7558053a436b9cbba3.zip |
Update Mapgen VoxelManipulator on buffer invalidation
Diffstat (limited to 'src/map.cpp')
-rw-r--r-- | src/map.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/map.cpp b/src/map.cpp index 147bd3584..236972ae9 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -2757,6 +2757,28 @@ MapBlock *ServerMap::getBlockOrEmerge(v3s16 p3d) void ServerMap::prepareBlock(MapBlock *block) { } +// N.B. This requires no synchronization, since data will not be modified unless +// the VoxelManipulator being updated belongs to the same thread. +void ServerMap::updateVManip(v3s16 pos) +{ + Mapgen *mg = m_emerge->getCurrentMapgen(); + if (!mg) + return; + + ManualMapVoxelManipulator *vm = mg->vm; + if (!vm) + return; + + if (!vm->m_area.contains(pos)) + return; + + s32 idx = vm->m_area.index(pos); + vm->m_data[idx] = getNodeNoEx(pos); + vm->m_flags[idx] &= ~VOXELFLAG_NO_DATA; + + vm->m_is_dirty = true; +} + s16 ServerMap::findGroundLevel(v2s16 p2d) { #if 0 @@ -3523,6 +3545,7 @@ void ServerMap::PrintInfo(std::ostream &out) ManualMapVoxelManipulator::ManualMapVoxelManipulator(Map *map): VoxelManipulator(), + m_is_dirty(false), m_create_area(false), m_map(map) { @@ -3617,6 +3640,8 @@ void ManualMapVoxelManipulator::initialEmerge(v3s16 blockpos_min, m_loaded_blocks[p] = flags; } + + m_is_dirty = false; } void ManualMapVoxelManipulator::blitBackAll( |