diff options
author | Howaner <franzi.moos@googlemail.com> | 2014-09-17 17:53:42 +0200 |
---|---|---|
committer | Howaner <franzi.moos@googlemail.com> | 2014-09-17 17:53:42 +0200 |
commit | 3ee211bbbaa4673b2f38846fadb1d2bfba93b1a3 (patch) | |
tree | 51d9769bfabd448db03d89b6ec4241a3bf554464 | |
parent | Fixed SQLiteCpp downgrade (diff) | |
download | cuberite-3ee211bbbaa4673b2f38846fadb1d2bfba93b1a3.tar cuberite-3ee211bbbaa4673b2f38846fadb1d2bfba93b1a3.tar.gz cuberite-3ee211bbbaa4673b2f38846fadb1d2bfba93b1a3.tar.bz2 cuberite-3ee211bbbaa4673b2f38846fadb1d2bfba93b1a3.tar.lz cuberite-3ee211bbbaa4673b2f38846fadb1d2bfba93b1a3.tar.xz cuberite-3ee211bbbaa4673b2f38846fadb1d2bfba93b1a3.tar.zst cuberite-3ee211bbbaa4673b2f38846fadb1d2bfba93b1a3.zip |
Diffstat (limited to '')
-rw-r--r-- | src/ByteBuffer.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/ByteBuffer.cpp b/src/ByteBuffer.cpp index 851c63858..262e0e3b5 100644 --- a/src/ByteBuffer.cpp +++ b/src/ByteBuffer.cpp @@ -497,9 +497,12 @@ bool cByteBuffer::ReadPosition(int & a_BlockX, int & a_BlockY, int & a_BlockZ) return false; } - a_BlockX = Value >> 38; - a_BlockY = Value << 26 >> 52; - a_BlockZ = Value << 38 >> 38; + UInt32 BlockXRaw = (Value >> 38) & 0x3ffffff; + UInt32 BlockYRaw = (Value >> 26) & 0xfff; + UInt32 BlockZRaw = (Value & 0x3ffffff); + a_BlockX = ((BlockXRaw & 0x2000000) == 0) ? BlockXRaw : (~(BlockXRaw & 0x1ffffff)) + 1; + a_BlockY = ((BlockYRaw & 0x800) == 0) ? BlockYRaw : (~(BlockXRaw & 0x7ff)) + 1; + a_BlockZ = ((BlockZRaw & 0x2000000) == 0) ? BlockZRaw : (~(BlockZRaw & 0x1ffffff)) + 1; return true; } |