1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

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
This commit is contained in:
gregorycu 2015-01-14 01:19:54 +11:00 committed by Craig Robbins
parent 805c8e51e5
commit db3466dbe8
3 changed files with 72 additions and 22 deletions

View file

@ -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 (