diff options
| author | Mel <einebeere@gmail.com> | 2022-10-22 00:16:14 +0200 |
|---|---|---|
| committer | Mel <einebeere@gmail.com> | 2022-10-22 00:16:14 +0200 |
| commit | 7b20942c765334687fd5f58df4c0190601b97b58 (patch) | |
| tree | 771a9df76abf29b9fd43636584f01e7f6125490c /src/World/World.cpp | |
| parent | 20c53c7473fc6cc08944f502f078dfe57bcae1c9 (diff) | |
| download | meowcraft-7b20942c765334687fd5f58df4c0190601b97b58.tar.zst meowcraft-7b20942c765334687fd5f58df4c0190601b97b58.zip | |
Fix chunk index hash to show infinite world
Diffstat (limited to 'src/World/World.cpp')
| -rw-r--r-- | src/World/World.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/World/World.cpp b/src/World/World.cpp index 5a0d729..449ba2d 100644 --- a/src/World/World.cpp +++ b/src/World/World.cpp @@ -31,8 +31,8 @@ std::vector<World::ChunkData> World::get_visible_chunks(Vector<3> position) { } std::unordered_set<ChunkIndex> World::get_visible_chunk_indices(Vector<3> position) const { - int64_t center_x = std::round(position.x() / CHUNK_WIDTH); - int64_t center_y = std::round(position.z() / CHUNK_HEIGHT); + int32_t center_x = std::round(position.x() / CHUNK_WIDTH); + int32_t center_y = std::round(position.z() / CHUNK_HEIGHT); auto upper_x_bound = center_x + m_view_distance_radius; auto lower_x_bound = center_x - m_view_distance_radius; @@ -41,8 +41,8 @@ std::unordered_set<ChunkIndex> World::get_visible_chunk_indices(Vector<3> positi std::unordered_set<ChunkIndex> indices{}; indices.reserve(m_view_distance_radius * m_view_distance_radius * 4); - for (int64_t x = lower_x_bound; x < upper_x_bound; x++) { - for (int64_t y = lower_y_bound; y < upper_y_bound; y++) { + for (int32_t x = lower_x_bound; x < upper_x_bound; x++) { + for (int32_t y = lower_y_bound; y < upper_y_bound; y++) { indices.emplace(x, y); } } |
