summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaG1924 <12997935+LaG1924@users.noreply.github.com>2018-03-06 16:04:56 +0100
committerLaG1924 <12997935+LaG1924@users.noreply.github.com>2018-03-06 19:21:00 +0100
commit4aec51ee6976f1ca7596d3870689bb761fffd56d (patch)
treeb87e2adcd5e4b47021e023709778b98a0e6227f5
parentMerge pull request #4 from QiZD90/master (diff)
downloadAltCraft-4aec51ee6976f1ca7596d3870689bb761fffd56d.tar
AltCraft-4aec51ee6976f1ca7596d3870689bb761fffd56d.tar.gz
AltCraft-4aec51ee6976f1ca7596d3870689bb761fffd56d.tar.bz2
AltCraft-4aec51ee6976f1ca7596d3870689bb761fffd56d.tar.lz
AltCraft-4aec51ee6976f1ca7596d3870689bb761fffd56d.tar.xz
AltCraft-4aec51ee6976f1ca7596d3870689bb761fffd56d.tar.zst
AltCraft-4aec51ee6976f1ca7596d3870689bb761fffd56d.zip
-rw-r--r--src/Section.cpp41
-rw-r--r--src/Section.hpp18
2 files changed, 4 insertions, 55 deletions
diff --git a/src/Section.cpp b/src/Section.cpp
index 2f72411..71937e2 100644
--- a/src/Section.cpp
+++ b/src/Section.cpp
@@ -52,26 +52,6 @@ Section::Section(Vector pos, unsigned char bitsPerBlock, std::vector<unsigned sh
hash = -1;
}
-Section::Section():hash(-1),bitsPerBlock(0) {
-}
-
-Section::~Section() {
-
-}
-
-Section::Section(Section && other) noexcept {
- using std::swap;
- swap(*this, other);
- hash = -1;
-}
-
-Section &Section::operator=(Section other) noexcept {
- using std::swap;
- swap(*this, other);
- hash = -1;
- return *this;
-}
-
BlockId Section::GetBlockId(Vector pos) const {
if (block.empty())
return BlockId{ 0,0 };
@@ -142,27 +122,6 @@ void Section::SetBlockId(Vector pos, BlockId value) {
hash = -1;
}
-void swap(Section& lhs, Section& rhs) noexcept {
- std::swap(lhs.block, rhs.block);
- std::swap(lhs.light, rhs.light);
- std::swap(lhs.sky, rhs.sky);
- std::swap(lhs.bitsPerBlock, rhs.bitsPerBlock);
- std::swap(lhs.palette, rhs.palette);
- std::swap(lhs.hash, rhs.hash);
- std::swap(lhs.worldPosition, rhs.worldPosition);
-}
-
-Section::Section(const Section &other) {
- worldPosition = other.worldPosition;
- this->block = other.block;
- this->light = other.light;
- this->sky = other.sky;
- this->bitsPerBlock = other.bitsPerBlock;
- this->palette = other.palette;
- this->hash = other.hash;
- this->worldPosition = other.worldPosition;
-}
-
Vector Section::GetPosition() const {
return worldPosition;
}
diff --git a/src/Section.hpp b/src/Section.hpp
index e647600..7617c24 100644
--- a/src/Section.hpp
+++ b/src/Section.hpp
@@ -10,11 +10,11 @@ class Section {
std::vector<long long> block;
std::vector<unsigned char> light;
std::vector<unsigned char> sky;
- unsigned char bitsPerBlock;
+ unsigned char bitsPerBlock = 0;
std::vector<unsigned short> palette;
Vector worldPosition;
- mutable size_t hash;
+ mutable size_t hash = 0;
void CalculateHash() const;
@@ -22,16 +22,8 @@ class Section {
public:
Section(Vector pos, unsigned char bitsPerBlock, std::vector<unsigned short> palette, std::vector<long long> blockData, std::vector<unsigned char> lightData, std::vector<unsigned char> skyData);
- Section();
-
- ~Section();
-
- Section(const Section &other);
-
- Section(Section &&other) noexcept;
-
- Section &operator=(Section other) noexcept;
-
+ Section() = default;
+
BlockId GetBlockId(Vector pos) const;
unsigned char GetBlockLight(Vector pos) const;
@@ -47,6 +39,4 @@ public:
Vector GetPosition() const;
size_t GetHash() const;
-
- friend void swap(Section& lhs, Section& rhs) noexcept;
}; \ No newline at end of file