diff options
author | Howaner <franzi.moos@googlemail.com> | 2014-08-20 22:25:05 +0200 |
---|---|---|
committer | Howaner <franzi.moos@googlemail.com> | 2014-08-20 22:25:05 +0200 |
commit | f7774ec33638bfc30cc29c1f70850a6072a31c93 (patch) | |
tree | c2c2896b87de9241b1555e4e2580aa6b3f401870 /src/Blocks/BlockFire.h | |
parent | Revert "Removes the fire if the block under the fire was broken." (diff) | |
parent | Merge pull request #1335 from mc-server/CodeFixes (diff) | |
download | cuberite-f7774ec33638bfc30cc29c1f70850a6072a31c93.tar cuberite-f7774ec33638bfc30cc29c1f70850a6072a31c93.tar.gz cuberite-f7774ec33638bfc30cc29c1f70850a6072a31c93.tar.bz2 cuberite-f7774ec33638bfc30cc29c1f70850a6072a31c93.tar.lz cuberite-f7774ec33638bfc30cc29c1f70850a6072a31c93.tar.xz cuberite-f7774ec33638bfc30cc29c1f70850a6072a31c93.tar.zst cuberite-f7774ec33638bfc30cc29c1f70850a6072a31c93.zip |
Diffstat (limited to '')
-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 df50d5962..b9f211042 100644 --- a/src/Blocks/BlockFire.h +++ b/src/Blocks/BlockFire.h @@ -55,8 +55,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) @@ -86,13 +86,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 @@ -144,8 +143,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) @@ -163,7 +162,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); @@ -177,7 +177,9 @@ public: { return false; } - } XZM = X2 + 1; // Set boundary, see previous + } + XZM = X2 + 1; // Set boundary, see previous + return (FoundFrameXP && FoundFrameXM); } @@ -199,7 +201,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); @@ -213,7 +216,9 @@ public: { return false; } - } XZM = Z2 + 1; + } + XZM = Z2 + 1; + return (FoundFrameZP && FoundFrameZM); } }; |