summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockComparator.h
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2015-06-27 00:24:51 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2015-12-18 14:17:38 +0100
commit5b62c4c3145c08b093521e42c565922fa85de4ad (patch)
treedca8cbfe86aa27af174da21f6835a8fbbe83d248 /src/Blocks/BlockComparator.h
parentMerge pull request #2770 from cuberite/RemoveChunkDataCollector (diff)
downloadcuberite-5b62c4c3145c08b093521e42c565922fa85de4ad.tar
cuberite-5b62c4c3145c08b093521e42c565922fa85de4ad.tar.gz
cuberite-5b62c4c3145c08b093521e42c565922fa85de4ad.tar.bz2
cuberite-5b62c4c3145c08b093521e42c565922fa85de4ad.tar.lz
cuberite-5b62c4c3145c08b093521e42c565922fa85de4ad.tar.xz
cuberite-5b62c4c3145c08b093521e42c565922fa85de4ad.tar.zst
cuberite-5b62c4c3145c08b093521e42c565922fa85de4ad.zip
Diffstat (limited to 'src/Blocks/BlockComparator.h')
-rw-r--r--src/Blocks/BlockComparator.h47
1 files changed, 25 insertions, 22 deletions
diff --git a/src/Blocks/BlockComparator.h b/src/Blocks/BlockComparator.h
index d4ec08dff..8f1822299 100644
--- a/src/Blocks/BlockComparator.h
+++ b/src/Blocks/BlockComparator.h
@@ -60,16 +60,17 @@ public:
return true;
}
- inline static Vector3i GetSideCoordinate(int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_Meta, bool a_bInverse)
+ inline static Vector3i GetSideCoordinate(const Vector3i & a_Position, NIBBLETYPE a_Meta, bool a_bInverse)
{
+ auto Position = a_Position;
if (!a_bInverse)
{
switch (a_Meta)
{
- case 0x0: a_BlockX++; break;
- case 0x1: a_BlockZ--; break;
- case 0x2: a_BlockX--; break;
- case 0x3: a_BlockZ++; break;
+ case 0x0: Position.x++; break;
+ case 0x1: Position.z--; break;
+ case 0x2: Position.x--; break;
+ case 0x3: Position.z++; break;
default:
{
LOGWARNING("%s: Unknown metadata: %d", __FUNCTION__, a_Meta);
@@ -82,10 +83,10 @@ public:
{
switch (a_Meta)
{
- case 0x0: a_BlockX--; break;
- case 0x1: a_BlockZ++; break;
- case 0x2: a_BlockX++; break;
- case 0x3: a_BlockZ--; break;
+ case 0x0: Position.x--; break;
+ case 0x1: Position.z++; break;
+ case 0x2: Position.x++; break;
+ case 0x3: Position.z--; break;
default:
{
LOGWARNING("%s: Unknown metadata: %d", __FUNCTION__, a_Meta);
@@ -95,17 +96,18 @@ public:
}
}
- return Vector3i(a_BlockX, a_BlockY, a_BlockZ);
+ return Position;
}
- inline static Vector3i GetRearCoordinate(int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_Meta)
+ inline static Vector3i GetRearCoordinate(const Vector3i & a_Position, NIBBLETYPE a_Meta)
{
+ auto Position = a_Position;
switch (a_Meta)
{
- case 0x0: a_BlockZ++; break;
- case 0x1: a_BlockX--; break;
- case 0x2: a_BlockZ--; break;
- case 0x3: a_BlockX++; break;
+ case 0x0: Position.z++; break;
+ case 0x1: Position.x--; break;
+ case 0x2: Position.z--; break;
+ case 0x3: Position.x++; break;
default:
{
LOGWARNING("%s: Unknown metadata: %d", __FUNCTION__, a_Meta);
@@ -114,17 +116,18 @@ public:
}
}
- return Vector3i(a_BlockX, a_BlockY, a_BlockZ);
+ return Position;
}
- inline static Vector3i GetFrontCoordinate(int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_Meta)
+ inline static Vector3i GetFrontCoordinate(const Vector3i & a_Position, NIBBLETYPE a_Meta)
{
+ auto Position = a_Position;
switch (a_Meta)
{
- case 0x0: a_BlockZ--; break;
- case 0x1: a_BlockX++; break;
- case 0x2: a_BlockZ++; break;
- case 0x3: a_BlockX--; break;
+ case 0x0: Position.z--; break;
+ case 0x1: Position.x++; break;
+ case 0x2: Position.z++; break;
+ case 0x3: Position.x--; break;
default:
{
LOGWARNING("%s: Unknown metadata: %d", __FUNCTION__, a_Meta);
@@ -133,7 +136,7 @@ public:
}
}
- return Vector3i(a_BlockX, a_BlockY, a_BlockZ);
+ return Position;
}
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override