From: Perttu Ahola Date: Sat, 11 Dec 2010 16:12:18 +0000 (+0200) Subject: removed accidental double flowWater X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=db49f37692d6a23db3e521736e5adcf285022827;p=zefram%2Fminetest%2Fminetest_engine.git removed accidental double flowWater --- diff --git a/src/voxel.cpp b/src/voxel.cpp index 15624fee..b85ba866 100644 --- a/src/voxel.cpp +++ b/src/voxel.cpp @@ -725,183 +725,6 @@ bool VoxelManipulator::flowWater(v3s16 removed_pos, flowWater(p, active_nodes, recursion_depth, debugprint, counter, counterlimit); -find_again: - // Try flowing water to empty positions around removed_pos. - // They are checked in reverse order compared to the previous loop. - for(s32 i=5; i>=0; i--) - { - //v3s16 p = removed_pos + dirs[i]; - p = removed_pos + v3s16(s1*dirs[i].X, dirs[i].Y, s2*dirs[i].Z); - - u8 f = m_flags[m_area.index(p)]; - // Water can't move to inexistent nodes - if(f & VOXELFLAG_INEXISTENT) - continue; - MapNode &n = m_data[m_area.index(p)]; - // Water can only move to air - if(n.d != MATERIAL_AIR) - continue; - - // Flow water to node - bool moved = - flowWater(p, active_nodes, recursion_depth, - debugprint, counter, counterlimit); - - if(moved) - { - // Search again from all neighbors - goto find_again; - } - } - - if(counter != NULL) - { - (*counter)++; - if((*counter) % 10 == 0) - dstream<<"flowWater(): moved "<<(*counter)<<" nodes" - < counterlimit) - { - dstream<<"Counter limit reached; returning"< &active_nodes, - int recursion_depth, bool debugprint, - int *counter, int counterlimit) -{ - v3s16 dirs[6] = { - v3s16(0,1,0), // top - v3s16(-1,0,0), // left - v3s16(1,0,0), // right - v3s16(0,0,-1), // front - v3s16(0,0,1), // back - v3s16(0,-1,0), // bottom - }; - - recursion_depth++; - - v3s16 p; - - // Randomize horizontal order - static s32 cs = 0; - if(cs < 3) - cs++; - else - cs = 0; - s16 s1 = (cs & 1) ? 1 : -1; - s16 s2 = (cs & 2) ? 1 : -1; - //dstream<<"s1="<= 3) - break; - continue; - } - // Else block is at some side. Select it if it has enough pressure - if(n.pressure >= 2) - { - break; - } - } - - // If there is nothing to move, return - if(i==6) - return false; - - // Switch nodes at p and removed_pos - u8 m = m_data[m_area.index(p)].d; - u8 f = m_flags[m_area.index(p)]; - m_data[m_area.index(p)].d = m_data[m_area.index(removed_pos)].d; - m_flags[m_area.index(p)] = m_flags[m_area.index(removed_pos)]; - m_data[m_area.index(removed_pos)].d = m; - m_flags[m_area.index(removed_pos)] = f; - - // Mark removed_pos checked - m_flags[m_area.index(removed_pos)] |= VOXELFLAG_CHECKED; - // If block was dropped from surface, increase pressure - if(i == 0 && m_data[m_area.index(removed_pos)].pressure == 1) - { - m_data[m_area.index(removed_pos)].pressure = 2; - } - - /*if(debugprint) - { - dstream<<"VoxelManipulator::flowWater(): Moved bubble:"<