Ajout de RetrieveChunk
This commit is contained in:
parent
af0464b3a2
commit
4bb865cbba
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#define FRAMES_RENDER_CHUNKS 2
|
#define FRAMES_RENDER_CHUNKS 2
|
||||||
#define FRAMES_UPDATE_CHUNKS 2
|
#define FRAMES_UPDATE_CHUNKS 2
|
||||||
|
#define FRAMES_DELETE_CHUNKS 2
|
||||||
|
|
||||||
#define VIEW_DISTANCE 512
|
#define VIEW_DISTANCE 512
|
||||||
#define MAX_SELECTION_DISTANCE 5
|
#define MAX_SELECTION_DISTANCE 5
|
||||||
|
BIN
SQCSim2021/media/chunks/26_85.chunk
Normal file
BIN
SQCSim2021/media/chunks/26_85.chunk
Normal file
Binary file not shown.
@ -79,3 +79,21 @@ void World::TransposeWorld(Player& player) {
|
|||||||
player.Transpose(x, y);
|
player.Transpose(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void World::CleanUpWorld(int& frames) {
|
||||||
|
if (!m_tbDeleted.empty() && !frames) {
|
||||||
|
m_tbDeleted.pop_back();
|
||||||
|
frames = FRAMES_DELETE_CHUNKS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Chunk* World::RetrieveChunk(int x, int y) {
|
||||||
|
for (int index = 0; index < m_tbDeleted.size(); ++index) {
|
||||||
|
int cx, cy;
|
||||||
|
m_tbDeleted.at(index)->GetPosition(cx, cy);
|
||||||
|
|
||||||
|
if (cx == x && cy == y)
|
||||||
|
return std::move(m_tbDeleted.at(index));
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
@ -27,11 +27,14 @@ class World {
|
|||||||
BlockType BlockAt(const Vector3f& pos, BlockType defaultBlockType = BTYPE_AIR) const;
|
BlockType BlockAt(const Vector3f& pos, BlockType defaultBlockType = BTYPE_AIR) const;
|
||||||
|
|
||||||
void TransposeWorld(Player& player);
|
void TransposeWorld(Player& player);
|
||||||
|
void CleanUpWorld(int& frames);
|
||||||
|
Chunk* RetrieveChunk(int x, int y);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Array2d<Chunk*> m_chunks = Array2d<Chunk*>(WORLD_SIZE_X, WORLD_SIZE_Y);
|
Array2d<Chunk*> m_chunks = Array2d<Chunk*>(WORLD_SIZE_X, WORLD_SIZE_Y);
|
||||||
std::vector<Chunk*> m_tbDeleted;
|
std::vector<Chunk*> m_tbDeleted;
|
||||||
|
|
||||||
int m_center[2] = {INT16_MAX / 2, INT16_MAX / 2};
|
int m_center[2] = {INT16_MAX / 2 - WORLD_SIZE_X / 2, INT16_MAX / 2 - WORLD_SIZE_Y / 2};
|
||||||
};
|
};
|
||||||
#endif // WORLD_H__
|
#endif // WORLD_H__
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user