Projet server.

This commit is contained in:
MarcEricMartel
2023-09-18 15:56:17 -04:00
parent cf75843117
commit c3058070e5
25 changed files with 4600 additions and 37 deletions

45
SQCSim-common/world.h Normal file
View File

@@ -0,0 +1,45 @@
#ifndef WORLD_H__
#define WORLD_H__
#include <fstream>
#include <string>
#include <vector>
#include <future>
#include <thread>
#include "define.h"
#include "chunk.h"
#include "array2d.h"
#include "vector3.h"
#include "player.h"
#include "bullet.h"
class Chunk;
class Player;
class Bullet;
class World {
public:
World();
~World();
Array2d<Chunk*>& GetChunks();
Chunk* ChunkAt(float x, float y, float z) const;
Chunk* ChunkAt(const Vector3f& pos) const;
BlockType BlockAt(float x, float y, float z, BlockType defaultBlockType = BTYPE_AIR) const;
BlockType BlockAt(const Vector3f& pos, BlockType defaultBlockType = BTYPE_AIR) const;
void GetScope(unsigned int& x, unsigned int& y);
void ChangeBlockAtCursor(BlockType blockType, Player& player, bool& block);
void ChangeBlockAtPosition(BlockType blockType, Vector3f pos);
private:
Array2d<Chunk*> m_chunks = Array2d<Chunk*>(WORLD_SIZE_X, WORLD_SIZE_Y);
std::vector<Chunk*> m_tbDeleted;
unsigned int m_center[2] = { UINT16_MAX / 2 - WORLD_SIZE_X, UINT16_MAX / 2 - WORLD_SIZE_Y };
};
#endif // WORLD_H__