diff options
author | Mattes D <github@xoft.cz> | 2014-08-20 16:23:31 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2014-08-20 16:23:31 +0200 |
commit | 5410a36f92c1c94f25552dff4a46b9611f0cb917 (patch) | |
tree | 920627577c09fd3270b08bab3e7a6d3d29d52025 /src/Blocks/BlockFire.h | |
parent | Player: Silenced a few type conversion warnings. (diff) | |
parent | Removed old classes from the CMakeLists.txt (diff) | |
download | cuberite-5410a36f92c1c94f25552dff4a46b9611f0cb917.tar cuberite-5410a36f92c1c94f25552dff4a46b9611f0cb917.tar.gz cuberite-5410a36f92c1c94f25552dff4a46b9611f0cb917.tar.bz2 cuberite-5410a36f92c1c94f25552dff4a46b9611f0cb917.tar.lz cuberite-5410a36f92c1c94f25552dff4a46b9611f0cb917.tar.xz cuberite-5410a36f92c1c94f25552dff4a46b9611f0cb917.tar.zst cuberite-5410a36f92c1c94f25552dff4a46b9611f0cb917.zip |
Diffstat (limited to 'src/Blocks/BlockFire.h')
-rw-r--r-- | src/Blocks/BlockFire.h | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/Blocks/BlockFire.h b/src/Blocks/BlockFire.h index f52825362..c6a3e62cf 100644 --- a/src/Blocks/BlockFire.h +++ b/src/Blocks/BlockFire.h @@ -60,8 +60,8 @@ public: return "step.wood"; } - /// Traces along YP until it finds an obsidian block, returns Y difference or 0 if no portal, and -1 for border - /// Takes the X, Y, and Z of the base block; with an optional MaxY for portal border finding + /** Traces along YP until it finds an obsidian block, returns Y difference or 0 if no portal, and -1 for border + Takes the X, Y, and Z of the base block; with an optional MaxY for portal border finding */ int FindObsidianCeiling(int X, int Y, int Z, cChunkInterface & a_ChunkInterface, int MaxY = 0) { if (a_ChunkInterface.GetBlock(X, Y, Z) != E_BLOCK_OBSIDIAN) @@ -91,13 +91,12 @@ public: return newY; } } - else { return 0; } } return 0; } - /// Evaluates if coords have a valid border on top, based on MaxY + /** Evaluates if coords have a valid border on top, based on MaxY */ bool EvaluatePortalBorder(int X, int FoundObsidianY, int Z, int MaxY, cChunkInterface & a_ChunkInterface) { for (int checkBorder = FoundObsidianY + 1; checkBorder <= MaxY - 1; checkBorder++) // FoundObsidianY + 1: FoundObsidianY has already been checked in FindObsidianCeiling; MaxY - 1: portal doesn't need corners @@ -149,8 +148,8 @@ public: return; } - /// Evaluates if coordinates are a portal going XP/XM; returns true if so, and writes boundaries to variable - /// Takes coordinates of base block and Y coord of target obsidian ceiling + /** Evaluates if coordinates are a portal going XP/XM; returns true if so, and writes boundaries to variable + Takes coordinates of base block and Y coord of target obsidian ceiling */ bool FindPortalSliceX(int X1, int X2, int Y, int Z, int MaxY, cChunkInterface & a_ChunkInterface) { Dir = 1; // Set assumed direction (will change if portal turns out to be facing the other direction) @@ -168,7 +167,8 @@ public: { return false; // Not valid slice, no portal can be formed } - } XZP = X1 - 1; // Set boundary of frame interior + } + XZP = X1 - 1; // Set boundary of frame interior for (; ((a_ChunkInterface.GetBlock(X2, Y, Z) == E_BLOCK_OBSIDIAN) || (a_ChunkInterface.GetBlock(X2, Y + 1, Z) == E_BLOCK_OBSIDIAN)); X2--) // Go the other direction (XM) { int Value = FindObsidianCeiling(X2, Y, Z, a_ChunkInterface, MaxY); @@ -182,7 +182,9 @@ public: { return false; } - } XZM = X2 + 1; // Set boundary, see previous + } + XZM = X2 + 1; // Set boundary, see previous + return (FoundFrameXP && FoundFrameXM); } @@ -204,7 +206,8 @@ public: { return false; } - } XZP = Z1 - 1; + } + XZP = Z1 - 1; for (; ((a_ChunkInterface.GetBlock(X, Y, Z2) == E_BLOCK_OBSIDIAN) || (a_ChunkInterface.GetBlock(X, Y + 1, Z2) == E_BLOCK_OBSIDIAN)); Z2--) { int Value = FindObsidianCeiling(X, Y, Z2, a_ChunkInterface, MaxY); @@ -218,7 +221,9 @@ public: { return false; } - } XZM = Z2 + 1; + } + XZM = Z2 + 1; + return (FoundFrameZP && FoundFrameZM); } }; |