summaryrefslogtreecommitdiff
path: root/src/voxel.cpp
diff options
context:
space:
mode:
authorCraig Robbins <kde.psych@gmail.com>2014-11-21 14:43:29 +1000
committerCraig Robbins <kde.psych@gmail.com>2014-11-21 14:56:45 +1000
commitd406ac994b8092c5bd2dc32eda1a2eafbf95a30c (patch)
treee8b0f002ae3b69e0e0e8c1756482809f7d9aa09e /src/voxel.cpp
parentea404979e16ce769c640266039ca3d696189f9d1 (diff)
downloadminetest-d406ac994b8092c5bd2dc32eda1a2eafbf95a30c.tar.gz
minetest-d406ac994b8092c5bd2dc32eda1a2eafbf95a30c.tar.bz2
minetest-d406ac994b8092c5bd2dc32eda1a2eafbf95a30c.zip
Optimise functions from CNodeDefManager and VoxelManipulator
CNodeDefManager::get() VoxelManipulator::addArea()
Diffstat (limited to 'src/voxel.cpp')
-rw-r--r--src/voxel.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/voxel.cpp b/src/voxel.cpp
index 19f2deb32..13711d1a1 100644
--- a/src/voxel.cpp
+++ b/src/voxel.cpp
@@ -142,7 +142,7 @@ void VoxelManipulator::print(std::ostream &o, INodeDefManager *ndef,
}
}
-void VoxelManipulator::addArea(VoxelArea area)
+void VoxelManipulator::addArea(const VoxelArea &area)
{
// Cancel if requested area has zero volume
if(area.getExtent() == v3s16(0,0,0))
@@ -310,7 +310,8 @@ void VoxelManipulator::unspreadLight(enum LightBank bank, v3s16 p, u8 oldlight,
v3s16(-1,0,0), // left
};
- addArea(VoxelArea(p - v3s16(1,1,1), p + v3s16(1,1,1)));
+ VoxelArea voxel_area(p - v3s16(1,1,1), p + v3s16(1,1,1));
+ addArea(voxel_area);
// Loop through 6 neighbors
for(u16 i=0; i<6; i++)
@@ -515,7 +516,8 @@ void VoxelManipulator::spreadLight(enum LightBank bank, v3s16 p,
v3s16(-1,0,0), // left
};
- addArea(VoxelArea(p - v3s16(1,1,1), p + v3s16(1,1,1)));
+ VoxelArea voxel_area(p - v3s16(1,1,1), p + v3s16(1,1,1));
+ addArea(voxel_area);
u32 i = m_area.index(p);
@@ -619,7 +621,8 @@ void VoxelManipulator::spreadLight(enum LightBank bank,
{
v3s16 pos = *j;
- addArea(VoxelArea(pos - v3s16(1,1,1), pos + v3s16(1,1,1)));
+ VoxelArea voxel_area(pos - v3s16(1,1,1), pos + v3s16(1,1,1));
+ addArea(voxel_area);
u32 i = m_area.index(pos);