summaryrefslogtreecommitdiffstats
path: root/src/world
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/world/Block.hpp (renamed from include/world/Block.hpp)0
-rw-r--r--src/world/Collision.hpp (renamed from include/world/Collision.hpp)0
-rw-r--r--src/world/GameState.cpp2
-rw-r--r--src/world/GameState.hpp (renamed from include/GameState.hpp)0
-rw-r--r--src/world/Section.cpp55
-rw-r--r--src/world/Section.hpp (renamed from include/world/Section.hpp)0
-rw-r--r--src/world/World.hpp (renamed from include/world/World.hpp)0
7 files changed, 30 insertions, 27 deletions
diff --git a/include/world/Block.hpp b/src/world/Block.hpp
index 2f823fe..2f823fe 100644
--- a/include/world/Block.hpp
+++ b/src/world/Block.hpp
diff --git a/include/world/Collision.hpp b/src/world/Collision.hpp
index b88fbf7..b88fbf7 100644
--- a/include/world/Collision.hpp
+++ b/src/world/Collision.hpp
diff --git a/src/world/GameState.cpp b/src/world/GameState.cpp
index 79e2f1b..d3a6bd3 100644
--- a/src/world/GameState.cpp
+++ b/src/world/GameState.cpp
@@ -1,4 +1,4 @@
-#include <GameState.hpp>
+#include <world/GameState.hpp>
GameState::GameState(NetworkClient *Net, bool &quit) : nc(Net), isRunning(quit) {
Front = glm::vec3(0.0f, 0.0f, -1.0f);
diff --git a/include/GameState.hpp b/src/world/GameState.hpp
index 6741882..6741882 100644
--- a/include/GameState.hpp
+++ b/src/world/GameState.hpp
diff --git a/src/world/Section.cpp b/src/world/Section.cpp
index 279d2b2..ff2a4fb 100644
--- a/src/world/Section.cpp
+++ b/src/world/Section.cpp
@@ -47,28 +47,28 @@ void Section::Parse() {
endswap(&longArray[i]);
std::vector<unsigned short> blocks;
blocks.reserve(4096);
- {
- auto begin = std::chrono::steady_clock::now();
- int bitPos = 0;
- unsigned short t = 0;
- for (size_t i = 0; i < m_dataBlocksLen; i++) {
- for (int j = 0; j < 8; j++) {
- t |= (m_dataBlocks[i] & 0x01) ? 0x80 : 0x00;
- t >>= 1;
- m_dataBlocks[i] >>= 1;
- bitPos++;
- if (bitPos >= m_bitsPerBlock) {
- bitPos = 0;
- t >>= m_bitsPerBlock - 1;
- blocks.push_back(t);
- t = 0;
- }
- }
- }
- auto end = std::chrono::steady_clock::now();
- std::chrono::duration<double, std::milli> time = end - begin;
- totalParsingTime += time.count();
- }
+ {
+ auto begin = std::chrono::steady_clock::now();
+ int bitPos = 0;
+ unsigned short t = 0;
+ for (size_t i = 0; i < m_dataBlocksLen; i++) {
+ for (int j = 0; j < 8; j++) {
+ t |= (m_dataBlocks[i] & 0x01) ? 0x80 : 0x00;
+ t >>= 1;
+ m_dataBlocks[i] >>= 1;
+ bitPos++;
+ if (bitPos >= m_bitsPerBlock) {
+ bitPos = 0;
+ t >>= m_bitsPerBlock - 1;
+ blocks.push_back(t);
+ t = 0;
+ }
+ }
+ }
+ auto end = std::chrono::steady_clock::now();
+ std::chrono::duration<double, std::milli> time = end - begin;
+ totalParsingTime += time.count();
+ }
std::vector<byte> light;
light.reserve(4096);
for (int i = 0; i < 2048; i++) {
@@ -137,8 +137,11 @@ Vector Section::GetPosition() {
}
size_t Section::GetHash() {
- if (m_blocks.empty())
- return 0;
- std::string str((unsigned char*)m_blocks.data(), (unsigned char*)m_blocks.data() + m_blocks.size() * sizeof(Block));
- return std::hash<std::string>{}(str);
+ if (m_blocks.empty()) return 0;
+
+ unsigned char *from = reinterpret_cast<unsigned char *>(m_blocks.data());
+ size_t length = m_blocks.size() * sizeof(Block);
+
+ std::string str(from, from + length);
+ return std::hash<std::string>{}(str);
} \ No newline at end of file
diff --git a/include/world/Section.hpp b/src/world/Section.hpp
index 2df0cfe..2df0cfe 100644
--- a/include/world/Section.hpp
+++ b/src/world/Section.hpp
diff --git a/include/world/World.hpp b/src/world/World.hpp
index 6b09f1f..6b09f1f 100644
--- a/include/world/World.hpp
+++ b/src/world/World.hpp