mirror of
https://github.com/Relintai/voxelman.git
synced 2025-04-17 21:06:32 +02:00
Fix error when the data margins are 0.
This commit is contained in:
parent
17dfbb4cab
commit
01c57c30e6
@ -128,6 +128,7 @@ bool VoxelWorldEditor::do_input_action(Camera *p_camera, const Point2 &p_point,
|
||||
bz += _world->get_chunk_size_z();
|
||||
}
|
||||
|
||||
if (_world->get_data_margin_end() > 0) {
|
||||
if (bx == 0) {
|
||||
Ref<VoxelChunk> chunk = _world->get_or_create_chunk(x - 1, y, z);
|
||||
chunk->set_voxel(selected_voxel, _world->get_chunk_size_x(), by, bz, 0);
|
||||
@ -145,7 +146,9 @@ bool VoxelWorldEditor::do_input_action(Camera *p_camera, const Point2 &p_point,
|
||||
chunk->set_voxel(selected_voxel, bx, by, _world->get_chunk_size_z(), 0);
|
||||
chunk->build();
|
||||
}
|
||||
}
|
||||
|
||||
if (_world->get_data_margin_start() > 0) {
|
||||
if (bx == _world->get_chunk_size_x() - 1) {
|
||||
Ref<VoxelChunk> chunk = _world->get_or_create_chunk(x + 1, y, z);
|
||||
chunk->set_voxel(selected_voxel, -1, by, bz, 0);
|
||||
@ -163,6 +166,7 @@ bool VoxelWorldEditor::do_input_action(Camera *p_camera, const Point2 &p_point,
|
||||
chunk->set_voxel(selected_voxel, bx, by, -1, 0);
|
||||
chunk->build();
|
||||
}
|
||||
}
|
||||
|
||||
Ref<VoxelChunk> chunk = _world->get_or_create_chunk(x, y, z);
|
||||
chunk->set_voxel(selected_voxel, bx, by, bz, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user