From 71760514fc044f273914c17b1510fa3cf10419b3 Mon Sep 17 00:00:00 2001 From: LaG1924 <12997935+LaG1924@users.noreply.github.com> Date: Fri, 21 Apr 2017 18:31:43 +0500 Subject: 2017-04-21 --- World.hpp | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) (limited to 'World.hpp') diff --git a/World.hpp b/World.hpp index 288dc4f..ac3433b 100644 --- a/World.hpp +++ b/World.hpp @@ -1,28 +1,33 @@ #pragma once #include +#include +#include +#include +#include #include "Block.hpp" #include "Packet.hpp" - -const int SECTION_WIDTH=16; -const int SECTION_LENGTH=16; -const int SECTION_HEIGHT=16; +#include "Section.hpp" class World { public: - Block &GetBlock(PositionI pos); - void SetBlock(PositionI pos, Block block); + World(); + ~World(); void ParseChunkData(Packet packet); - - - std::map m_blocks; + std::map m_sections; private: - - - size_t ParseSectionData(int chunkX, int chunkZ, bool isGroundContinous, int section, byte *data); - - std::vector - ParseBlocks(byte *bytes, int dataLength, std::vector palette, byte bitsPerBlock); - - int m_dimension=0; + //utility vars + World(const World& other); + World&operator=(const World &other); + //utility methods + std::thread m_sectionParseThread; + std::queue::iterator> m_sectionToParse; + //game vars + int m_dimension = 0; + //game methods + std::mutex m_parseSectionMutex; + std::condition_variable m_parseSectionWaiter; + Section ParseSection(byte *data, size_t &dataLen); + void SectionParsingThread(); + bool isContinue=true; }; \ No newline at end of file -- cgit v1.2.3