mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Update Mapgen VoxelManipulator on buffer invalidation
This commit is contained in:
parent
3fa4f782d9
commit
9e4e7072da
6 changed files with 75 additions and 10 deletions
25
src/map.cpp
25
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(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue