diff options
author | madmaxoft <github@xoft.cz> | 2014-04-28 22:22:07 +0200 |
---|---|---|
committer | madmaxoft <github@xoft.cz> | 2014-04-28 22:22:07 +0200 |
commit | 55a7f392ccf99b55ee09ade2fb15468e8d3e4d66 (patch) | |
tree | 056729e3d12d1083e2214cbff12ce3b7d5e2eb21 /src/ChunkDef.h | |
parent | Fixed a MSVC warning. (diff) | |
download | cuberite-55a7f392ccf99b55ee09ade2fb15468e8d3e4d66.tar cuberite-55a7f392ccf99b55ee09ade2fb15468e8d3e4d66.tar.gz cuberite-55a7f392ccf99b55ee09ade2fb15468e8d3e4d66.tar.bz2 cuberite-55a7f392ccf99b55ee09ade2fb15468e8d3e4d66.tar.lz cuberite-55a7f392ccf99b55ee09ade2fb15468e8d3e4d66.tar.xz cuberite-55a7f392ccf99b55ee09ade2fb15468e8d3e4d66.tar.zst cuberite-55a7f392ccf99b55ee09ade2fb15468e8d3e4d66.zip |
Diffstat (limited to 'src/ChunkDef.h')
-rw-r--r-- | src/ChunkDef.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/ChunkDef.h b/src/ChunkDef.h index 054168bdd..83f3c8f5f 100644 --- a/src/ChunkDef.h +++ b/src/ChunkDef.h @@ -246,8 +246,8 @@ public: { if ((x < Width) && (x > -1) && (y < Height) && (y > -1) && (z < Width) && (z > -1)) { - int Index = MakeIndexNoCheck(x, y, z); - if ((size_t)(Index / 2) >= a_Buffer.size()) + size_t Index = (size_t)MakeIndexNoCheck(x, y, z); + if ((Index / 2) >= a_Buffer.size()) { return (a_IsSkyLightNibble ? 0xff : 0); } @@ -281,7 +281,7 @@ public: { a_Buffer.resize((size_t)((a_BlockIdx / 2) + 1)); } - a_Buffer[(size_t)(a_BlockIdx / 2)] = PackNibble(a_Buffer, a_BlockIdx, a_Nibble); + a_Buffer[(size_t)(a_BlockIdx / 2)] = PackNibble(a_Buffer, (size_t)a_BlockIdx, a_Nibble); } @@ -297,19 +297,19 @@ public: return; } - int Index = MakeIndexNoCheck(x, y, z); - if ((size_t)(Index / 2) >= a_Buffer.size()) + size_t Index = (size_t)MakeIndexNoCheck(x, y, z); + if ((Index / 2) >= a_Buffer.size()) { - a_Buffer.resize((size_t)((Index / 2) + 1)); + a_Buffer.resize(((Index / 2) + 1)); } - a_Buffer[(size_t)(Index / 2)] = PackNibble(a_Buffer, Index, a_Nibble); + a_Buffer[(Index / 2)] = PackNibble(a_Buffer, Index, a_Nibble); } private: - inline static NIBBLETYPE PackNibble(const COMPRESSED_NIBBLETYPE & a_Buffer, int a_Index, NIBBLETYPE a_Nibble) + inline static NIBBLETYPE PackNibble(const COMPRESSED_NIBBLETYPE & a_Buffer, size_t a_Index, NIBBLETYPE a_Nibble) { return static_cast<NIBBLETYPE>( (a_Buffer[a_Index / 2] & (0xf0 >> ((a_Index & 1) * 4))) | // The untouched nibble @@ -318,7 +318,7 @@ private: } - inline static NIBBLETYPE ExpandNibble(const COMPRESSED_NIBBLETYPE & a_Buffer, int a_Index) + inline static NIBBLETYPE ExpandNibble(const COMPRESSED_NIBBLETYPE & a_Buffer, size_t a_Index) { return (a_Buffer[a_Index / 2] >> ((a_Index & 1) * 4)) & 0x0f; } |