diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-06-04 14:14:38 +0200 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-06-04 14:14:38 +0200 |
commit | 86e5273cd17be8b8f1ae8a9b0dc2d212cb9b2791 (patch) | |
tree | 1b5c702a9e9da9115e64c317bdad5aba3544d4a1 /src/LightingThread.cpp | |
parent | Implemented bed homes (diff) | |
parent | Merge pull request #1059 from mc-server/coverity_fixes (diff) | |
download | cuberite-86e5273cd17be8b8f1ae8a9b0dc2d212cb9b2791.tar cuberite-86e5273cd17be8b8f1ae8a9b0dc2d212cb9b2791.tar.gz cuberite-86e5273cd17be8b8f1ae8a9b0dc2d212cb9b2791.tar.bz2 cuberite-86e5273cd17be8b8f1ae8a9b0dc2d212cb9b2791.tar.lz cuberite-86e5273cd17be8b8f1ae8a9b0dc2d212cb9b2791.tar.xz cuberite-86e5273cd17be8b8f1ae8a9b0dc2d212cb9b2791.tar.zst cuberite-86e5273cd17be8b8f1ae8a9b0dc2d212cb9b2791.zip |
Diffstat (limited to 'src/LightingThread.cpp')
-rw-r--r-- | src/LightingThread.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/LightingThread.cpp b/src/LightingThread.cpp index 5459644af..dc19bf500 100644 --- a/src/LightingThread.cpp +++ b/src/LightingThread.cpp @@ -18,20 +18,17 @@ class cReader : public cChunkDataCallback { - virtual void BlockTypes(const BLOCKTYPE * a_Type) override + virtual void ChunkData(const cChunkData & a_ChunkBuffer) override { - // ROW is a block of 16 Blocks, one whole row is copied at a time (hopefully the compiler will optimize that) - // C++ doesn't permit copying arrays, but arrays as a part of a struct is ok :) - typedef struct {BLOCKTYPE m_Row[16]; } ROW; - ROW * InputRows = (ROW *)a_Type; - ROW * OutputRows = (ROW *)m_BlockTypes; + BLOCKTYPE * OutputRows = m_BlockTypes; int InputIdx = 0; int OutputIdx = m_ReadingChunkX + m_ReadingChunkZ * cChunkDef::Width * 3; for (int y = 0; y < cChunkDef::Height; y++) { for (int z = 0; z < cChunkDef::Width; z++) { - OutputRows[OutputIdx] = InputRows[InputIdx++]; + a_ChunkBuffer.CopyBlockTypes(OutputRows + OutputIdx * 16, InputIdx * 16, 16); + InputIdx++; OutputIdx += 3; } // for z // Skip into the next y-level in the 3x3 chunk blob; each level has cChunkDef::Width * 9 rows |