From 63d1f997ca460c7f5118f7d2007651cfa5bf6006 Mon Sep 17 00:00:00 2001 From: MarcEricMartel Date: Sat, 16 Dec 2023 14:41:01 -0500 Subject: [PATCH] blob --- SQCSim-common/define.h | 2 +- SQCSim-srv/server.cpp | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/SQCSim-common/define.h b/SQCSim-common/define.h index f6737af..e1f9c0a 100644 --- a/SQCSim-common/define.h +++ b/SQCSim-common/define.h @@ -35,7 +35,7 @@ #define TIME_DAMAGE_BOOST 10 //secondes #define TIME_INVINCIBLE_BOOST 4 //secondes #define STRENGTH_SPEED_BOOST 10 //Pourcentage -#define BULLET_TIME .2 +#define BULLET_TIME .2 //secondes #define SYNC_ACC 200 // ms #define CMOD_ACC 1500 // ms diff --git a/SQCSim-srv/server.cpp b/SQCSim-srv/server.cpp index be92139..1113a9a 100644 --- a/SQCSim-srv/server.cpp +++ b/SQCSim-srv/server.cpp @@ -281,11 +281,11 @@ void Server::Run() { /* Process */ if (conn->m_nsync) { - if (conn->player->m_hit) { + /*if (conn->player->m_hit) { std::string str = conn->player->GetUsername(); str = str.append(" has been hit: ").append(std::to_string(conn->player->GetHP())); Log(str, false, false); - } + }*/ Timestamp tstamp = conn->Run(m_world); @@ -367,7 +367,7 @@ void Server::Run() { endtime += .001; } } - + for (auto& bull : netbull) { for (auto& [key, conn] : m_conns) if (bull->id != conn->GetHash(false)) // Pour pas repitcher au joueur sa propre balle. @@ -375,6 +375,9 @@ void Server::Run() { delete bull; } netbull.clear(); + + if (!bullets.empty()) + std::cout << "Bullets: " << bullets.size() << std::endl; for (auto bull = bullets.begin(); bull != bullets.end(); ++bull) { ChunkMod* cmod = nullptr; @@ -386,12 +389,13 @@ void Server::Run() { delete bullet; } } + for (auto& bull: bullit) bullets.erase(bull); bullit.clear(); for (auto& chat : chatlog) { - Log(chat->mess, false, false); + Log(chat->mess, false, false); for (auto& [key, conn] : m_conns) sendPackTo(m_sock_udp, chat, &m_buf, conn->getAddr()); delete chat;