diff options
author | Tycho <work.tycho+git@gmail.com> | 2014-04-26 19:50:23 +0200 |
---|---|---|
committer | Tycho <work.tycho+git@gmail.com> | 2014-04-26 19:50:23 +0200 |
commit | e40f9d6e5b93e840e3d67e79f5ba49da1fbb75f0 (patch) | |
tree | 8cb2098da03ec8c2d66f8f36a53e4cf4280b554a /src/LightingThread.cpp | |
parent | Replaced all the .data() calls so the code compiles in VS2008 (diff) | |
download | cuberite-e40f9d6e5b93e840e3d67e79f5ba49da1fbb75f0.tar cuberite-e40f9d6e5b93e840e3d67e79f5ba49da1fbb75f0.tar.gz cuberite-e40f9d6e5b93e840e3d67e79f5ba49da1fbb75f0.tar.bz2 cuberite-e40f9d6e5b93e840e3d67e79f5ba49da1fbb75f0.tar.lz cuberite-e40f9d6e5b93e840e3d67e79f5ba49da1fbb75f0.tar.xz cuberite-e40f9d6e5b93e840e3d67e79f5ba49da1fbb75f0.tar.zst cuberite-e40f9d6e5b93e840e3d67e79f5ba49da1fbb75f0.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 302473d71..56d5dba22 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 ChunkBuffer(const cChunkBuffer & 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.CopyBlocks(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 |