diff --git a/src/Client/Systems/Menus/Menu/ButtonCallbacks.cpp b/src/Client/Systems/Menus/Menu/ButtonCallbacks.cpp index c5875161..3aa51c0f 100644 --- a/src/Client/Systems/Menus/Menu/ButtonCallbacks.cpp +++ b/src/Client/Systems/Menus/Menu/ButtonCallbacks.cpp @@ -156,7 +156,6 @@ namespace Menu { { auto idsButton = Registry::getInstance().getEntitiesByComponents({typeid(Types::Button)}); - Logger::error("!!!!!!!!!!!sendReadyPacket!!!!!!"); Nitwork::NitworkClient::getInstance().addReadyMsg(); for (auto &id : idsButton) { Registry::getInstance().removeEntity(id); diff --git a/src/Client/Systems/Menus/Menu/MenuSystems.cpp b/src/Client/Systems/Menus/Menu/MenuSystems.cpp index 4deec32d..a162511a 100644 --- a/src/Client/Systems/Menus/Menu/MenuSystems.cpp +++ b/src/Client/Systems/Menus/Menu/MenuSystems.cpp @@ -200,7 +200,7 @@ namespace Systems { ::Menu::MenuBuilder::getInstance().initMenuSceneEntity( Json::getInstance().getDatasFromList(jsonData)); } catch (std::runtime_error &err) { - Logger::info(err.what()); + Logger::warn(err.what()); } SystemManagersDirector::getInstance().getSystemManager(managerId).removeSystem(systemId); } @@ -254,11 +254,11 @@ namespace Systems { return; } try { -// Parallax::initParalax(); + Parallax::initParalax(); preloadTexture(); initHud(); } catch (std::runtime_error &err) { - Logger::info(err.what()); + Logger::warn(err.what()); } SystemManagersDirector::getInstance().getSystemManager(managerId).removeSystem(systemId); } diff --git a/src/Client/Systems/Network/ClientNetwork.cpp b/src/Client/Systems/Network/ClientNetwork.cpp index e7be31fb..21a37488 100644 --- a/src/Client/Systems/Network/ClientNetwork.cpp +++ b/src/Client/Systems/Network/ClientNetwork.cpp @@ -316,7 +316,6 @@ namespace Systems { } for (auto &id : otherPlayersIds) { if (arrOtherPlayers[id].constId == playerDeath.playerId) { - Logger::fatal("Other player death: " + std::to_string(playerDeath.playerId)); arrHealth[id].hp = 0; return; } diff --git a/src/Game/CreateMissiles.cpp b/src/Game/CreateMissiles.cpp index 3c966eec..cbb0d9b4 100644 --- a/src/Game/CreateMissiles.cpp +++ b/src/Game/CreateMissiles.cpp @@ -80,7 +80,6 @@ namespace Systems { #ifdef CLIENT static void addSpriteRectsForBullet(nlohmann::json &bulletData, Types::CollisionRect &collisionRect) { - Logger::fatal("cacaaaaaaaaaaaaaaaaaaa------------------------------------------"); Json &json = Json::getInstance(); const std::string bulletPath = json.getDataFromJson(bulletData, "spritePath"); Types::Rect spriteRect = json.getDataFromJson(bulletData, "spriteRect"); @@ -100,11 +99,9 @@ namespace Systems { std::size_t createPlayerMissile(Types::Position pos, Types::Missiles &typeOfMissile) { - Logger::fatal("Create missile"); if (typeOfMissile.type >= MAX_MISSILE_TYPE || typeOfMissile.type < 0) { throw std::runtime_error("Unknown missile type"); } - Logger::fatal("Create missile2"); Json &json = Json::getInstance(); std::size_t id = Registry::getInstance().addEntity(); nlohmann::json bulletData = @@ -125,7 +122,6 @@ namespace Systems { Registry::getInstance().getComponents().insertBack(playerAlliesComp); addPhysicsToEntity(bulletData, pos); - Logger::fatal("type of missile = " + std::to_string(typeOfMissile.type) + " pos = " + std::to_string(pos.x) + " " + std::to_string(pos.y)); Registry::getInstance().getComponents().insertBack(pos); Registry::getInstance().getComponents().insertBack(collisionRect); Registry::getInstance().getComponents().insertBack(missileType); diff --git a/src/Game/GameSystems.cpp b/src/Game/GameSystems.cpp index 2aed90ab..b32f54ea 100644 --- a/src/Game/GameSystems.cpp +++ b/src/Game/GameSystems.cpp @@ -82,7 +82,6 @@ namespace Systems { static void sendMissileDeath(std::size_t arrId) { - Logger::fatal("start send missile death"); auto &arrMissiles = Registry::getInstance().getComponents(); if (arrMissiles.exist(arrId)) { @@ -96,7 +95,6 @@ namespace Systems { static void sendEnemyDeath(std::size_t arrId) { - Logger::fatal("start send enemy death"); auto &arrEnemies = Registry::getInstance().getComponents(); if (!arrEnemies.exist(arrId)) { @@ -107,7 +105,6 @@ namespace Systems { #else Nitwork::NitworkServer::getInstance().addEnemyDeathMessage(arrEnemies[arrId].getConstId().id); #endif - Logger::fatal("end send enemy death"); } #ifdef CLIENT static void sendLifeUpdateToServer(std::size_t id) @@ -124,7 +121,6 @@ namespace Systems { static void sendPlayerDeathToServer(std::size_t id) { - Logger::fatal("start send player death"); auto &arrPlayer = Registry::getInstance().getComponents(); auto &arrOtherPlayer = Registry::getInstance().getComponents(); @@ -135,7 +131,6 @@ namespace Systems { Logger::debug("other player send death " + std::to_string(id)); Nitwork::NitworkClient::getInstance().addPlayerDeathMsg(arrOtherPlayer[id].constId); } - Logger::fatal("end send player death"); } #endif diff --git a/src/Nitwork/ANitwork.cpp b/src/Nitwork/ANitwork.cpp index 282f25a9..de4d87f6 100644 --- a/src/Nitwork/ANitwork.cpp +++ b/src/Nitwork/ANitwork.cpp @@ -247,8 +247,7 @@ namespace Nitwork { try { action.second(action.first.data, action.first.endpoint); } catch (std::exception &e) { - Logger::fatal("StartInputHandler:"); - Logger::error("NITWORK: catch action: " + std::string(e.what())); + Logger::error("StartInputHandler: NITWORK: catch action: " + std::string(e.what())); } } _actions.clear(); diff --git a/src/Nitwork/NitworkClient.cpp b/src/Nitwork/NitworkClient.cpp index 98e7d7d3..e5f27b55 100644 --- a/src/Nitwork/NitworkClient.cpp +++ b/src/Nitwork/NitworkClient.cpp @@ -152,12 +152,10 @@ namespace Nitwork { }, .msg = {.magick = MAGICK_DISCONNECT_LOBBY}, }; - Logger::error("------------------------------------ Sending disconnect lobby msg: " + std::to_string(NITWORK_DISCONNECT_LOBBY) + " " + std::to_string(MAGICK_DISCONNECT_LOBBY)); Packet packet( packetDisconnectLobby.action.magick, std::make_any(packetDisconnectLobby), _serverEndpoint); - Logger::fatal("Disconnecting from lobby"); addPacketToSend(packet); } @@ -172,7 +170,6 @@ namespace Nitwork { }, .msgInit = {.magick = MAGICK_INIT} }; - Logger::error("------------------------------------ Sending init msg: " + std::to_string(NITWORK_INIT) + " " + std::to_string(MAGICK_INIT)); Packet packet( packetMsgInit.action.magick, std::make_any(packetMsgInit), @@ -188,7 +185,6 @@ namespace Nitwork { .action = {.magick = NITWORK_READY}, .msgReady = {.magick = MAGICK_READY} }; - Logger::error("------------------------------------ Sending ready msg: " + std::to_string(NITWORK_READY) + " " + std::to_string(MAGICK_READY)); Packet packet( packetMsgReady.action.magick, std::make_any(packetMsgReady), @@ -284,7 +280,6 @@ namespace Nitwork { .life = life, }, }; - Logger::error("------------------------------------ Sending life update msg: " + std::to_string(playerId) + " " + std::to_string(MAGICK_LIFE_UPDATE)); Packet packet( packetLifeUpdate.action.magick, std::make_any(packetLifeUpdate), @@ -348,7 +343,6 @@ namespace Nitwork { .missileId = id, }, }; - Logger::error("------------------------------------ Sending missile death msg: " + std::to_string(NITWORK_MISSILE_DEATH) + " " + std::to_string(MAGICK_MISSILE_DEATH)); Packet packet( packetMissileDeath.action.magick, std::make_any(packetMissileDeath), @@ -366,7 +360,6 @@ namespace Nitwork { }, .msg = {.magick = MAGICK_REQUEST_LIST_LOBBY}, }; - Logger::error("------------------------------------ Sending list lobby msg: " + std::to_string(NITWORK_LIST_LOBBY) + " " + std::to_string(MAGICK_REQUEST_LIST_LOBBY)); Packet packet( packetListLobby.action.magick, std::make_any(packetListLobby), @@ -393,7 +386,6 @@ namespace Nitwork { .maxNbPlayer = maxNbPlayer, .ownerInfos = {.ip = "", .port = _mainServerEndpoint.port()}} }; - Logger::error("------------------------------------ Sending create lobby msg: " + std::to_string(NITWORK_CREATE_LOBBY) + " " + std::to_string(MAGICK_CREATE_LOBBY)); std::strcpy(packetCreateLobby.msg.name, (name.size() > 32 ? name.substr(0, 32) : name).c_str()); std::strcpy( packetCreateLobby.msg.ownerInfos.ip, @@ -419,7 +411,6 @@ namespace Nitwork { }, .msg = {.magick = MAGICK_CONNECT_MAIN_SERVER}, }; - Logger::error("------------------------------------ Sending connect main server msg: " + std::to_string(NITWORK_CONNECT_MAIN_SERVER) + " " + std::to_string(MAGICK_CONNECT_MAIN_SERVER)); Packet packet( packetConnectMainServer.action.magick, std::make_any(packetConnectMainServer), @@ -438,7 +429,6 @@ namespace Nitwork { }, .msg = {.magick = MAGICK_CONNECT_LOBBY}, }; - Logger::error("------------------------------------ Sending connect lobby msg: " + std::to_string(NITWORK_CONNECT_LOBBY) + " " + std::to_string(MAGICK_CONNECT_LOBBY)); Packet packet( packetConnectLobby.action.magick, std::make_any(packetConnectLobby), diff --git a/src/Nitwork/NitworkMainServer.cpp b/src/Nitwork/NitworkMainServer.cpp index c72e20d8..159e74a0 100644 --- a/src/Nitwork/NitworkMainServer.cpp +++ b/src/Nitwork/NitworkMainServer.cpp @@ -76,7 +76,7 @@ namespace Nitwork { void NitworkMainServer::handleInitMsg(std::any & /* unused */, boost::asio::ip::udp::endpoint &endpoint) { if (isClientAlreadyConnected(endpoint)) { - Logger::info("Client already connected"); + Logger::warn("Client already connected"); sendConnectMainServerResp(endpoint); return; } diff --git a/src/Nitwork/NitworkServer.cpp b/src/Nitwork/NitworkServer.cpp index 34b532d7..03943baa 100644 --- a/src/Nitwork/NitworkServer.cpp +++ b/src/Nitwork/NitworkServer.cpp @@ -182,14 +182,13 @@ namespace Nitwork { bool canConnect = true; if (_isGameStarted) { - Logger::info("Game already started, connection refused"); + Logger::warn("Game already started, connection refused"); return; } if (msgData.magick != MAGICK_CONNECT_LOBBY) { Logger::error("Error: magick not matching"); return; } - Logger::error("magick connect lobby = " + std::to_string(msgData.magick) + " (" + MAGICK_CONNECT_LOBBY + ")"); if (_endpoints.size() >= _serverInfos.maxNbPlayer) { Logger::error("Too many clients, can't add an other one"); canConnect = false; @@ -202,7 +201,7 @@ namespace Nitwork { { std::lock_guard lock(Registry::getInstance().mutex); if (_isGameStarted) { - Logger::info("Game already started, connection refused"); + Logger::warn("Game already started, connection refused"); return; } if (_endpoints.size() >= _serverInfos.maxNbPlayer) { @@ -213,7 +212,6 @@ namespace Nitwork { Logger::error("Client already connected"); return; } - Logger::error("WTF WTF ICI"); _endpoints.emplace_back(endpoint); auto playerId = static_cast(_endpoints.size() - 1); auto &jsonInstance = Json::getInstance(); @@ -251,7 +249,7 @@ namespace Nitwork { NitworkServer::handleReadyMsg(const std::any & /* unused */, boost::asio::ip::udp::endpoint &endpoint) { if (_isGameStarted) { - Logger::info("Game already started, connection refused"); + Logger::warn("Game already started, connection refused"); return; } if (!isClientAlreadyConnected(endpoint)) { @@ -273,7 +271,7 @@ namespace Nitwork { NitworkServer::handleRelativePositionMsg(const std::any &msg, boost::asio::ip::udp::endpoint &endpoint) { if (!isClientAlreadyConnected(endpoint)) { - Logger::info("Client not connected"); + Logger::warn("Client not connected"); return; } auto msgData = std::any_cast(msg);