aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorgregorycu <gregory.currie@gmail.com>2015-01-14 01:19:54 +1100
committerCraig Robbins <kde.psych@gmail.com>2015-01-18 20:30:33 +1000
commitdb3466dbe885f27b87ceca0a4bb115169f844a0c (patch)
tree6e93becce3183574477ef766f641dcd7e54d680f /src/util
parent805c8e51e5dd4dfad381a0d40b4388b5de90becf (diff)
downloadminetest-db3466dbe885f27b87ceca0a4bb115169f844a0c.tar.gz
minetest-db3466dbe885f27b87ceca0a4bb115169f844a0c.tar.bz2
minetest-db3466dbe885f27b87ceca0a4bb115169f844a0c.zip
Water fixes
Change must_reflow to a deque Add overload for MapBlock::raiseModified that takes a const char*. This is a speed improvement. Comment out unused variable Optimisations to block offset calculations
Diffstat (limited to 'src/util')
-rw-r--r--src/util/numeric.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/util/numeric.h b/src/util/numeric.h
index 098a5631c..db1eb003e 100644
--- a/src/util/numeric.h
+++ b/src/util/numeric.h
@@ -85,6 +85,26 @@ inline v3s16 getContainerPos(v3s16 p, v3s16 d)
);
}
+inline void getContainerPosWithOffset(s16 p, s16 d, s16 &container, s16 &offset)
+{
+ container = (p >= 0 ? p : p - d + 1) / d;
+ offset = p & (d - 1);
+}
+
+inline void getContainerPosWithOffset(const v2s16 &p, s16 d, v2s16 &container, v2s16 &offset)
+{
+ getContainerPosWithOffset(p.X, d, container.X, offset.X);
+ getContainerPosWithOffset(p.Y, d, container.Y, offset.Y);
+}
+
+inline void getContainerPosWithOffset(const v3s16 &p, s16 d, v3s16 &container, v3s16 &offset)
+{
+ getContainerPosWithOffset(p.X, d, container.X, offset.X);
+ getContainerPosWithOffset(p.Y, d, container.Y, offset.Y);
+ getContainerPosWithOffset(p.Z, d, container.Z, offset.Z);
+}
+
+
inline bool isInArea(v3s16 p, s16 d)
{
return (