Le bonhomme n'a plus la maladie de Parkinson, et le jeu refonctionne sur MSVC++.
This commit is contained in:
@@ -13,45 +13,53 @@ class World {
|
||||
|
||||
Array2d<Chunk*>& GetChunks();
|
||||
|
||||
template <class T>
|
||||
Chunk* World::ChunkAt(T x, T y, T z) const {
|
||||
int cx = (int)x / CHUNK_SIZE_X;
|
||||
int cz = (int)z / CHUNK_SIZE_Z;
|
||||
|
||||
if (cx >= VIEW_DISTANCE || // L'array en ce moment est de VIEW_DISTANCE par VIEW_DISTANCE.
|
||||
cz >= VIEW_DISTANCE ||
|
||||
cx < 0 || cz < 0)
|
||||
return 0;
|
||||
Chunk* ChunkAt(float x, float y, float z) const;
|
||||
Chunk* ChunkAt(const Vector3f& pos) const;
|
||||
|
||||
return m_chunks.Get(cx, cz);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
Chunk* World::ChunkAt(const Vector3<T>& pos) const { return ChunkAt(pos.x, pos.y, pos.z); }
|
||||
|
||||
template <class T>
|
||||
BlockType World::BlockAt(T x, T y, T z, BlockType defaultBlockType = BTYPE_AIR) const {
|
||||
Chunk* c = ChunkAt(x, y, z);
|
||||
|
||||
if (!c)
|
||||
return defaultBlockType;
|
||||
|
||||
int bx = (int)x % CHUNK_SIZE_X;
|
||||
int by = (int)y % CHUNK_SIZE_Y;
|
||||
int bz = (int)z % CHUNK_SIZE_Z;
|
||||
|
||||
return c->GetBlock(bx, by, bz);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
BlockType World::BlockAt(Vector3<T>& pos, BlockType defaultBlockType = BTYPE_AIR) const {
|
||||
return BlockAt(pos.x, pos.y, pos.z);
|
||||
}
|
||||
|
||||
BlockType BlockAt(float x, float y, float z, BlockType defaultBlockType = BTYPE_AIR) const;
|
||||
BlockType BlockAt(const Vector3f& pos, BlockType defaultBlockType = BTYPE_AIR) const;
|
||||
|
||||
private:
|
||||
Array2d<Chunk*> m_chunks = Array2d<Chunk*>(VIEW_DISTANCE, VIEW_DISTANCE);
|
||||
|
||||
int m_center[2] = {0, 0};
|
||||
};
|
||||
//
|
||||
//template <class T>
|
||||
//Chunk* World::ChunkAt(T x, T y, T z) const {
|
||||
// int cx = (int)x / CHUNK_SIZE_X;
|
||||
// int cz = (int)z / CHUNK_SIZE_Z;
|
||||
//
|
||||
// if (cx >= VIEW_DISTANCE || // L'array en ce moment est de VIEW_DISTANCE par VIEW_DISTANCE.
|
||||
// cz >= VIEW_DISTANCE ||
|
||||
// cx < 0 || cz < 0)
|
||||
// return 0;
|
||||
//
|
||||
// return m_chunks.Get(cx, cz);
|
||||
//}
|
||||
//
|
||||
//template <class T>
|
||||
//Chunk* World::ChunkAt(const Vector3<T>& pos) const { return ChunkAt(pos.x, pos.y, pos.z); }
|
||||
//
|
||||
//template <class T>
|
||||
//BlockType World::BlockAt(T x, T y, T z, BlockType defaultBlockType) const {
|
||||
// Chunk* c = ChunkAt(x, y, z);
|
||||
//
|
||||
// if (!c)
|
||||
// return defaultBlockType;
|
||||
//
|
||||
// int bx = (int)x % CHUNK_SIZE_X;
|
||||
// int by = (int)y % CHUNK_SIZE_Y;
|
||||
// int bz = (int)z % CHUNK_SIZE_Z;
|
||||
//
|
||||
// return c->GetBlock(bx, by, bz);
|
||||
//}
|
||||
//
|
||||
//template <class T>
|
||||
//BlockType World::BlockAt(const Vector3<T>& pos, BlockType defaultBlockType) const {
|
||||
// return BlockAt(pos.x, pos.y, pos.z);
|
||||
//}
|
||||
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user