summaryrefslogtreecommitdiffstats
path: root/src/Section.hpp
diff options
context:
space:
mode:
authorLaG1924 <12997935+LaG1924@users.noreply.github.com>2017-08-18 17:13:01 +0200
committerLaG1924 <12997935+LaG1924@users.noreply.github.com>2017-08-18 17:13:01 +0200
commita2fe2786682e626dae25db2d375280c83b615796 (patch)
tree34bc8295ad75b967519959e6300aada5531e2345 /src/Section.hpp
parent2017-08-17 (diff)
downloadAltCraft-a2fe2786682e626dae25db2d375280c83b615796.tar
AltCraft-a2fe2786682e626dae25db2d375280c83b615796.tar.gz
AltCraft-a2fe2786682e626dae25db2d375280c83b615796.tar.bz2
AltCraft-a2fe2786682e626dae25db2d375280c83b615796.tar.lz
AltCraft-a2fe2786682e626dae25db2d375280c83b615796.tar.xz
AltCraft-a2fe2786682e626dae25db2d375280c83b615796.tar.zst
AltCraft-a2fe2786682e626dae25db2d375280c83b615796.zip
Diffstat (limited to '')
-rw-r--r--src/Section.hpp38
1 files changed, 22 insertions, 16 deletions
diff --git a/src/Section.hpp b/src/Section.hpp
index f40fdf9..5422cf3 100644
--- a/src/Section.hpp
+++ b/src/Section.hpp
@@ -15,37 +15,43 @@ const int SECTION_WIDTH = 16;
const int SECTION_LENGTH = 16;
const int SECTION_HEIGHT = 16;
-class Section {
- std::vector<unsigned short> m_palette;
- byte *m_dataBlocks = nullptr;
- size_t m_dataBlocksLen;
- byte *m_dataLight = nullptr;
- byte *m_dataSkyLight = nullptr;
- byte m_bitsPerBlock = 0;
- std::vector<Block> m_blocks;
- std::condition_variable parseWaiter;
+struct PackedSection {
+ Vector position;
+
+ int bitsPerBlock;
+
+ std::vector<unsigned short> palette;
+
+ std::vector<unsigned char> blocks;
+ std::vector<unsigned char> light;
+ std::vector<unsigned char> sky;
- Section();
+ PackedSection(Vector position, byte *dataBlocks, size_t dataBlocksLength, byte *dataLight, byte *dataSky, byte bitsPerBlock,
+ std::vector<unsigned short> palette);
+};
+
+class Section {
+ std::vector<Block> blocks;
Vector worldPosition;
public:
- void Parse();
-
- Section(Vector position, byte *dataBlocks, size_t dataBlocksLength, byte *dataLight, byte *dataSky, byte bitsPerBlock,
- std::vector<unsigned short> palette);
+
+ Section(PackedSection data);
~Section();
Block &GetBlock(Vector pos);
+ Block GetBlock(Vector pos) const;
+
Section &operator=(Section other);
friend void swap(Section &a, Section &b);
Section(const Section &other);
- Vector GetPosition();
+ Vector GetPosition() const;
- size_t GetHash();
+ size_t GetHash() const;
}; \ No newline at end of file