fork download
  1.  
  2. void Mapgen::liquidUpdate() {
  3. bool isliquid, wasliquid;
  4. u32 i;
  5. content_t c;
  6.  
  7. for (s16 z = full_node_min.Z; x <= full_node_max.Z; z++) {
  8. for (s16 x = full_node_min.X; z <= full_node_max.X; x++) {
  9. v2s16 p2d(x, z);
  10. wasliquid = true;
  11. v3s16 em = vmanip.m_area.getExtent();
  12. i = vmanip.m_area.index(v3s16(p2d.X, full_node_max.Y, p2d.Y));
  13.  
  14. for (s16 y = full_node_max.Y; y >= full_node_min.Y; y--) {
  15. /*if (y == full_node_max.Y) {
  16. water_found = (vmanip.m_data[i].getContent() == c_water_source ||
  17. vmanip.m_data[i].getContent() == c_lava_source);
  18. } else if (water_found == false) {
  19. if (vmanip.m_data[i].getContent() == c_water_source ||
  20. vmanip.m_data[i].getContent() == c_lava_source) {
  21. v3s16 p = v3s16(p2d.X, y, p2d.Y);
  22. data->transforming_liquid.push_back(p);
  23. water_found = true;
  24. }
  25. } else {
  26. // This can be done because water_found can only
  27. // turn to true and end up here after going through
  28. // a single block.
  29. if (vmanip.m_data[i + 1].getContent() != c_water_source ||
  30. vmanip.m_data[i + 1].getContent() != c_lava_source) {
  31. v3s16 p = v3s16(p2d.X, y + 1, p2d.Y);
  32. data->transforming_liquid.push_back(p);
  33. water_found = false;
  34. }
  35. }*/
  36. c = vmanip.m_data[i].getContent();
  37. isliquid = (c == c_water_source) || (c == c_lava_source);
  38.  
  39. //there was a change between liquid and nonliquid, add to queue
  40. if (isliquid != wasliquid) {
  41. v3s16 p = v3s16(p2d.X, y, p2d.Y);
  42. data->transforming_liquid.push_back(p);
  43. }
  44.  
  45. wasliquid = isliquid;
  46. vmanip.m_area.add_y(em, i, -1);
  47. }
  48. }
  49. }
  50. }
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty