diff options
author | Mattes D <github@xoft.cz> | 2019-09-29 14:59:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-29 14:59:24 +0200 |
commit | 365cbc6e1cea96741e26c9ce912b003f8fd2c62c (patch) | |
tree | f23682c47928597791c53f3a300b03494ffde417 /src/BlockArea.h | |
parent | Cactus can now grow and will be dropped if there is no place to grow. (diff) | |
download | cuberite-365cbc6e1cea96741e26c9ce912b003f8fd2c62c.tar cuberite-365cbc6e1cea96741e26c9ce912b003f8fd2c62c.tar.gz cuberite-365cbc6e1cea96741e26c9ce912b003f8fd2c62c.tar.bz2 cuberite-365cbc6e1cea96741e26c9ce912b003f8fd2c62c.tar.lz cuberite-365cbc6e1cea96741e26c9ce912b003f8fd2c62c.tar.xz cuberite-365cbc6e1cea96741e26c9ce912b003f8fd2c62c.tar.zst cuberite-365cbc6e1cea96741e26c9ce912b003f8fd2c62c.zip |
Diffstat (limited to 'src/BlockArea.h')
-rw-r--r-- | src/BlockArea.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/BlockArea.h b/src/BlockArea.h index 4a68f9a31..8f57c8e5e 100644 --- a/src/BlockArea.h +++ b/src/BlockArea.h @@ -388,6 +388,15 @@ public: NIBBLETYPE * GetBlockSkyLight(void) const { return m_BlockSkyLight.get(); } // NOTE: one byte per block! size_t GetBlockCount(void) const { return static_cast<size_t>(m_Size.x * m_Size.y * m_Size.z); } static size_t MakeIndexForSize(Vector3i a_RelPos, Vector3i a_Size); + + /** Returns the index into the internal arrays for the specified coords */ + size_t MakeIndex(Vector3i a_RelPos) const + { + return MakeIndexForSize(a_RelPos, m_Size); + } + + /** OBSOLETE, use the Vector3i-based overload instead. + Returns the index into the internal arrays for the specified coords */ size_t MakeIndex(int a_RelX, int a_RelY, int a_RelZ) const { return MakeIndexForSize({ a_RelX, a_RelY, a_RelZ }, m_Size); |