summaryrefslogtreecommitdiffstats
path: root/code/World.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/world/World.cpp (renamed from code/World.cpp)16
1 files changed, 13 insertions, 3 deletions
diff --git a/code/World.cpp b/src/world/World.cpp
index c19f88c..adbb3e1 100644
--- a/code/World.cpp
+++ b/src/world/World.cpp
@@ -21,13 +21,23 @@ void World::ParseChunkData(Packet packet) {
for (int i = 0; i < 16; i++) {
if (bitmask[i]) {
size_t len = 0;
- m_sections[PositionI(chunkX, chunkZ, i)] = ParseSection(content, len);
- m_sectionToParse.push(m_sections.find(PositionI(chunkX, chunkZ, i)));
- m_parseSectionWaiter.notify_one();
+ Vector chunkPosition = Vector(chunkX, i, chunkZ);
+ if (!m_sections.insert(std::make_pair(chunkPosition,ParseSection(content,len))).second)
+ std::cout<<"Chunk not created: "<<chunkPosition<<std::endl;
+ auto sectionIter = m_sections.find(chunkPosition);
+ if (sectionIter==m_sections.end())
+ std::cout<<"Created chunk not found: "<<chunkPosition<<std::endl;
+ else
+ sectionIter->second.Parse();
+ /*m_sections[chunkPosition] = ParseSection(content, len);
+ m_sections[chunkPosition].Parse();*/
+ /*m_sectionToParse.push(m_sections.find(Vector(chunkX, i, chunkZ)));
+ m_parseSectionWaiter.notify_one();*/
content += len;
}
}
delete[] contentOrigPtr;
+ //std::cout<<m_sections.size()<<std::endl;
}
Section World::ParseSection(byte *data, size_t &dataLen) {