From 2a0d1a059e556afaeb7f5b72205b26447e23286f Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sat, 11 Dec 2010 18:11:03 +0200 Subject: commit before some radicallish changes to water behavior --- src/test.cpp | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 65 insertions(+), 12 deletions(-) (limited to 'src/test.cpp') diff --git a/src/test.cpp b/src/test.cpp index 6b285e3a4..ebefb8e32 100644 --- a/src/test.cpp +++ b/src/test.cpp @@ -148,10 +148,45 @@ struct TestVoxelManipulator { void Run() { + /* + VoxelArea + */ + VoxelArea a(v3s16(-1,-1,-1), v3s16(1,1,1)); assert(a.index(0,0,0) == 1*3*3 + 1*3 + 1); assert(a.index(-1,-1,-1) == 0); + + VoxelArea c(v3s16(-2,-2,-2), v3s16(2,2,2)); + // An area that is 1 bigger in x+ and z- + VoxelArea d(v3s16(-2,-2,-3), v3s16(3,2,2)); + + core::list aa; + d.diff(c, aa); + + // Correct results + core::array results; + results.push_back(VoxelArea(v3s16(-2,-2,-3),v3s16(3,2,-3))); + results.push_back(VoxelArea(v3s16(3,-2,-2),v3s16(3,2,2))); + + assert(aa.size() == results.size()); + + dstream<<"Result of diff:"<::Iterator + i = aa.begin(); i != aa.end(); i++) + { + i->print(dstream); + dstream< active_nodes; + v.updateAreaWaterPressure(area, active_nodes); + + v.print(dstream, VOXELPRINT_WATERPRESSURE); + + s16 highest_y = -32768; + assert(v.getWaterPressure(v3s16(7, 1, 1), highest_y, 0) == -1); + assert(highest_y == 3); + + active_nodes.clear(); + active_nodes[v3s16(9,1,0)] = 1; + //v.flowWater(active_nodes, 0, false); + v.flowWater(active_nodes, 0, true); + + dstream<<"Final result of flowWater:"<