heum well

This commit is contained in:
MarcEricMartel
2023-11-06 17:59:57 -05:00
parent 253e49b1cc
commit bc1f4f750b
6 changed files with 70 additions and 30 deletions

View File

@@ -155,7 +155,7 @@ int Server::Ready() {
play.tid = log->tid;
sendPack<GameInfo>(sock, &m_game, &m_buf);
std::unique_ptr<Connection> conn = std::make_unique<Connection>(sock, sockad, *log, play);
Connection* conn = new Connection(sock, sockad, *log, play);
for (auto& [key, player] : m_players) {
sendPack<PlayerInfo>(player->getSock(), &play, &m_buf); // Envoyer les infos de joueur distant aux joueurs d<>j<EFBFBD> connect<63>s
@@ -183,16 +183,12 @@ void Server::Run() {
Log("Debut de la partie...", false, false);
int players = m_players.size();
std::thread* getPacksThreads = new std::thread[players];
m_world = std::make_unique<World>();
m_world = new World();
m_world->SetSeed(m_game.seed);
m_world->GetChunks().Reset(nullptr);
m_world->BuildWorld();
for (int x = 0; x < players; ++x)
getPacksThreads[x] = m_players[x].get()->start();
for (auto& [key, conn] : m_players) { // Creation des instances de joueurs et premier sync.
conn->player = std::make_unique<Player>(Vector3f(8.5f, CHUNK_SIZE_Y + 1.8f, 8.5f));
Sync sync;
@@ -207,7 +203,9 @@ void Server::Run() {
while (!endgame) {
for (auto& [key, conn] : m_players) {
conn->player->GetInput
conn->getPacks(m_sock_udp);
conn->Run(m_world);
conn->sendPacks(m_sock_udp, m_players);
}
}