From ad148587dcf5244c2d2011dba339786c765c54c4 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Wed, 4 Nov 2020 16:19:54 +0100 Subject: Make Lint Happy --- src/voxel.cpp | 168 +++++++++++++++++++++++++++------------------------------- 1 file changed, 77 insertions(+), 91 deletions(-) (limited to 'src/voxel.cpp') diff --git a/src/voxel.cpp b/src/voxel.cpp index 1f1d25373..ffedbd583 100644 --- a/src/voxel.cpp +++ b/src/voxel.cpp @@ -23,7 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "nodedef.h" #include "util/directiontables.h" #include "util/timetaker.h" -#include // memcpy, memset +#include // memcpy, memset /* Debug stuff @@ -48,81 +48,71 @@ void VoxelManipulator::clear() m_flags = nullptr; } -void VoxelManipulator::print(std::ostream &o, const NodeDefManager *ndef, - VoxelPrintMode mode) +void VoxelManipulator::print( + std::ostream &o, const NodeDefManager *ndef, VoxelPrintMode mode) { const v3s16 &em = m_area.getExtent(); v3s16 of = m_area.MinEdge; - o<<"size: "<=m_area.MinEdge.Y; y--) - { - if(em.X >= 3 && em.Y >= 3) - { - if (y==m_area.MinEdge.Y+2) o<<"^ "; - else if(y==m_area.MinEdge.Y+1) o<<"| "; - else if(y==m_area.MinEdge.Y+0) o<<"y x-> "; - else o<<" "; + o << "size: " << em.X << "x" << em.Y << "x" << em.Z << " offset: (" << of.X << "," + << of.Y << "," << of.Z << ")" << std::endl; + + for (s32 y = m_area.MaxEdge.Y; y >= m_area.MinEdge.Y; y--) { + if (em.X >= 3 && em.Y >= 3) { + if (y == m_area.MinEdge.Y + 2) + o << "^ "; + else if (y == m_area.MinEdge.Y + 1) + o << "| "; + else if (y == m_area.MinEdge.Y + 0) + o << "y x-> "; + else + o << " "; } - for(s32 z=m_area.MinEdge.Z; z<=m_area.MaxEdge.Z; z++) - { - for(s32 x=m_area.MinEdge.X; x<=m_area.MaxEdge.X; x++) - { - u8 f = m_flags[m_area.index(x,y,z)]; + for (s32 z = m_area.MinEdge.Z; z <= m_area.MaxEdge.Z; z++) { + for (s32 x = m_area.MinEdge.X; x <= m_area.MaxEdge.X; x++) { + u8 f = m_flags[m_area.index(x, y, z)]; char c; - if(f & VOXELFLAG_NO_DATA) + if (f & VOXELFLAG_NO_DATA) c = 'N'; - else - { + else { c = 'X'; - MapNode n = m_data[m_area.index(x,y,z)]; + MapNode n = m_data[m_area.index(x, y, z)]; content_t m = n.getContent(); u8 pr = n.param2; - if(mode == VOXELPRINT_MATERIAL) - { - if(m <= 9) + if (mode == VOXELPRINT_MATERIAL) { + if (m <= 9) c = m + '0'; - } - else if(mode == VOXELPRINT_WATERPRESSURE) - { - if(ndef->get(m).isLiquid()) - { + } else if (mode == VOXELPRINT_WATERPRESSURE) { + if (ndef->get(m).isLiquid()) { c = 'w'; - if(pr <= 9) + if (pr <= 9) c = pr + '0'; - } - else if(m == CONTENT_AIR) - { + } else if (m == CONTENT_AIR) { c = ' '; - } - else - { + } else { c = '#'; } - } - else if(mode == VOXELPRINT_LIGHT_DAY) - { - if(ndef->get(m).light_source != 0) + } else if (mode == VOXELPRINT_LIGHT_DAY) { + if (ndef->get(m).light_source != 0) c = 'S'; - else if(!ndef->get(m).light_propagates) + else if (!ndef->get(m).light_propagates) c = 'X'; - else - { - u8 light = n.getLight(LIGHTBANK_DAY, ndef); - if(light < 10) + else { + u8 light = n.getLight( + LIGHTBANK_DAY, + ndef); + if (light < 10) c = '0' + light; else - c = 'a' + (light-10); + c = 'a' + (light - 10); } } } - o<