summaryrefslogtreecommitdiffstats
path: root/src/world/Section.cpp
diff options
context:
space:
mode:
authorLaG1924 <12997935+LaG1924@users.noreply.github.com>2017-06-17 16:23:53 +0200
committerLaG1924 <12997935+LaG1924@users.noreply.github.com>2017-06-17 16:23:53 +0200
commit789f70b6f1a9067843dfc1ff73d86b645efe1da9 (patch)
treef3db085f2ac1ec5fd6ad0869a63e77a7f0fb1a17 /src/world/Section.cpp
parent2017-06-14 (diff)
downloadAltCraft-789f70b6f1a9067843dfc1ff73d86b645efe1da9.tar
AltCraft-789f70b6f1a9067843dfc1ff73d86b645efe1da9.tar.gz
AltCraft-789f70b6f1a9067843dfc1ff73d86b645efe1da9.tar.bz2
AltCraft-789f70b6f1a9067843dfc1ff73d86b645efe1da9.tar.lz
AltCraft-789f70b6f1a9067843dfc1ff73d86b645efe1da9.tar.xz
AltCraft-789f70b6f1a9067843dfc1ff73d86b645efe1da9.tar.zst
AltCraft-789f70b6f1a9067843dfc1ff73d86b645efe1da9.zip
Diffstat (limited to '')
-rw-r--r--src/world/Section.cpp31
1 files changed, 12 insertions, 19 deletions
diff --git a/src/world/Section.cpp b/src/world/Section.cpp
index 63c7f97..8f94ad7 100644
--- a/src/world/Section.cpp
+++ b/src/world/Section.cpp
@@ -1,7 +1,8 @@
#include "Section.hpp"
+
Section::Section(byte *dataBlocks, size_t dataBlocksLength, byte *dataLight, byte *dataSky, byte bitsPerBlock,
- std::vector<unsigned short> palette) {
+ std::vector<unsigned short> palette) {
m_dataBlocksLen = dataBlocksLength;
m_dataBlocks = new byte[m_dataBlocksLen];
std::copy(dataBlocks, dataBlocks + m_dataBlocksLen, m_dataBlocks);
@@ -93,30 +94,22 @@ void Section::Parse() {
m_dataSkyLight = nullptr;
parseWaiter.notify_all();
- /*static std::map<Block,int> totalBlocks;
- for (int x=0;x<16;x++)
- for (int y=0;y<16;y++)
- for (int z=0;z<16;z++)
- totalBlocks[GetBlock(Vector(x,y,z))]++;
- LOG(ERROR)<<"Logging chunk";
- for (auto& it:totalBlocks){
- LOG(WARNING)<<it.first.id<<":"<<(int)it.first.state<<" = "<<it.second;
- }*/
}
Section &Section::operator=(Section other) {
- other.swap(*this);
+ std::swap(*this,other);
return *this;
}
-void Section::swap(Section &other) {
- std::swap(other.m_dataBlocksLen, m_dataBlocksLen);
- std::swap(other.m_dataBlocks, m_dataBlocks);
- std::swap(other.m_dataLight, m_dataLight);
- std::swap(other.m_dataSkyLight, m_dataSkyLight);
- std::swap(other.m_blocks, m_blocks);
- std::swap(other.m_palette, m_palette);
- std::swap(other.m_bitsPerBlock, m_bitsPerBlock);
+void swap(Section &a, Section &b) {
+ using std::swap;
+ swap(a.m_dataBlocksLen, b.m_dataBlocksLen);
+ swap(a.m_dataBlocks, b.m_dataBlocks);
+ swap(a.m_dataLight, b.m_dataLight);
+ swap(a.m_dataSkyLight, b.m_dataSkyLight);
+ swap(a.m_blocks, b.m_blocks);
+ swap(a.m_palette, b.m_palette);
+ swap(a.m_bitsPerBlock, b.m_bitsPerBlock);
}
Section::Section(const Section &other) {