From 2a1cb3bbb78b35ebc639c9b99c781bbbb03744a2 Mon Sep 17 00:00:00 2001 From: tenshi Date: Sun, 5 Nov 2023 22:42:33 +0100 Subject: [PATCH 1/2] CLIENT-GAME: Fix windows compile --- assets/Json/playerData.json | 2 +- src/Client/Systems/Events/EventsSystems.cpp | 4 +++- src/Game/GameCustomTypes.cpp | 3 +++ src/Nitwork/NitworkServer.cpp | 8 ++++++-- src/Nitwork/NitworkServer.hpp | 5 ++++- 5 files changed, 17 insertions(+), 5 deletions(-) diff --git a/assets/Json/playerData.json b/assets/Json/playerData.json index f73de677..b71e0ba9 100644 --- a/assets/Json/playerData.json +++ b/assets/Json/playerData.json @@ -2,7 +2,7 @@ "player": { "spritePath": "assets/R-TypeSheet/spaceship.png", "damage": 10.0, - "health": 10.0, + "health": 2.0, "deadTime": 1000, "width": 350, "height" : 350, diff --git a/src/Client/Systems/Events/EventsSystems.cpp b/src/Client/Systems/Events/EventsSystems.cpp index f96c1b09..92d4faf9 100644 --- a/src/Client/Systems/Events/EventsSystems.cpp +++ b/src/Client/Systems/Events/EventsSystems.cpp @@ -238,7 +238,8 @@ namespace Systems { { bool found = false; const Raylib::Vector2 pos = {0, 2}; - constexpr std::size_t fontSize = 2; + const int fontSize = 2; + Types::FontSize fsz = {fontSize}; const std::string textKeywordWaveEnd = "WaveText"; const std::string textKeyWordGameEnd = "endGameText"; @@ -265,6 +266,7 @@ namespace Systems { Raylib::Color(Raylib::ColorDef::White), textKeyWordGameEnd); Registry::getInstance().getComponents().insertBack(endGameText); + Registry::getInstance().getComponents().insertBack(fsz); } } diff --git a/src/Game/GameCustomTypes.cpp b/src/Game/GameCustomTypes.cpp index df3caaa8..e8e96537 100644 --- a/src/Game/GameCustomTypes.cpp +++ b/src/Game/GameCustomTypes.cpp @@ -8,6 +8,7 @@ #include "GameCustomTypes.hpp" #ifdef CLIENT #include "B-luga-graphics/Raylib/Raylib.hpp" + #include "B-luga-graphics/GraphicsCustomTypes.hpp" #endif unsigned int Types::Enemy::_enemyNb = 0; @@ -43,6 +44,7 @@ namespace Types { } else { unsigned int previousWave = getWaveId(); const std::string text = "Wave " + std::to_string(previousWave) + " survived"; + Types::FontSize fsz = {fontSize}; for (auto &id : ids) { if (arrCol[id]->getKeyword() == textKeyword) { @@ -58,6 +60,7 @@ namespace Types { Raylib::Color(Raylib::ColorDef::White), textKeyword); Registry::getInstance().getComponents().insertBack(endWaveText); + Registry::getInstance().getComponents().insertBack(fsz); } #endif _waitingForNextWave = value; diff --git a/src/Nitwork/NitworkServer.cpp b/src/Nitwork/NitworkServer.cpp index 740d5822..eccfce49 100644 --- a/src/Nitwork/NitworkServer.cpp +++ b/src/Nitwork/NitworkServer.cpp @@ -7,6 +7,8 @@ #if defined(_WIN32) #define _CRT_SECURE_NO_WARNINGS + #include + #include #endif #include "NitworkServer.hpp" #include @@ -326,7 +328,9 @@ namespace Nitwork { return; } free(cmd); - _lobbyPids.emplace_back(pi.dwProcessId); + sendLobbyPid( + boost::asio::ip::udp::endpoint(boost::asio::ip::address::from_string(ownerIp), ownerPort), + pi.dwProcessId); #else pid_t c_pid = fork(); @@ -378,7 +382,7 @@ namespace Nitwork { _serverInfos.ownerInfos.port); } - void NitworkServer::sendLobbyPid(const boost::asio::ip::udp::endpoint &endpoint, pid_t pid) + void NitworkServer::sendLobbyPid(const boost::asio::ip::udp::endpoint &endpoint, int pid) { struct packetReplaceLobbyPid_s packetLobbyPid = { .header = {0, 0, 0, 0, 1, 0}, diff --git a/src/Nitwork/NitworkServer.hpp b/src/Nitwork/NitworkServer.hpp index 1be8223b..a18a2392 100644 --- a/src/Nitwork/NitworkServer.hpp +++ b/src/Nitwork/NitworkServer.hpp @@ -7,6 +7,9 @@ #pragma once +#if defined(_WIN32) + #include +#endif #include "ANitwork.hpp" #include "ServerNetwork.hpp" @@ -223,7 +226,7 @@ namespace Nitwork { * @param endpoint The endpoint of the client that sent the packet * @param pid The pid of the lobby */ - void sendLobbyPid(const boost::asio::ip::udp::endpoint &endpoint, pid_t pid); + void sendLobbyPid(const boost::asio::ip::udp::endpoint &endpoint, int pid); /** * @brief A map that contain the endpoint of the clients and their infos From 74b73e860b6a5e1eaab46b38e6a17d51ef5eac0d Mon Sep 17 00:00:00 2001 From: Github Actions Date: Sun, 5 Nov 2023 21:43:53 +0000 Subject: [PATCH 2/2] FORMAT-AUTO: automatic format on pull request #143 --- src/Client/Systems/Events/EventsSystems.cpp | 2 +- src/Game/GameCustomTypes.cpp | 4 ++-- src/Nitwork/NitworkServer.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Client/Systems/Events/EventsSystems.cpp b/src/Client/Systems/Events/EventsSystems.cpp index 92d4faf9..0aa75dd5 100644 --- a/src/Client/Systems/Events/EventsSystems.cpp +++ b/src/Client/Systems/Events/EventsSystems.cpp @@ -239,7 +239,7 @@ namespace Systems { bool found = false; const Raylib::Vector2 pos = {0, 2}; const int fontSize = 2; - Types::FontSize fsz = {fontSize}; + Types::FontSize fsz = {fontSize}; const std::string textKeywordWaveEnd = "WaveText"; const std::string textKeyWordGameEnd = "endGameText"; diff --git a/src/Game/GameCustomTypes.cpp b/src/Game/GameCustomTypes.cpp index e8e96537..a37962b7 100644 --- a/src/Game/GameCustomTypes.cpp +++ b/src/Game/GameCustomTypes.cpp @@ -7,8 +7,8 @@ #include "GameCustomTypes.hpp" #ifdef CLIENT - #include "B-luga-graphics/Raylib/Raylib.hpp" #include "B-luga-graphics/GraphicsCustomTypes.hpp" + #include "B-luga-graphics/Raylib/Raylib.hpp" #endif unsigned int Types::Enemy::_enemyNb = 0; @@ -44,7 +44,7 @@ namespace Types { } else { unsigned int previousWave = getWaveId(); const std::string text = "Wave " + std::to_string(previousWave) + " survived"; - Types::FontSize fsz = {fontSize}; + Types::FontSize fsz = {fontSize}; for (auto &id : ids) { if (arrCol[id]->getKeyword() == textKeyword) { diff --git a/src/Nitwork/NitworkServer.cpp b/src/Nitwork/NitworkServer.cpp index eccfce49..60416e55 100644 --- a/src/Nitwork/NitworkServer.cpp +++ b/src/Nitwork/NitworkServer.cpp @@ -10,7 +10,6 @@ #include #include #endif -#include "NitworkServer.hpp" #include #include "B-luga-physics/ECSSystems.hpp" #include "B-luga/Logger.hpp" @@ -18,6 +17,7 @@ #include "B-luga/SceneManager.hpp" #include "B-luga/SystemManagers/SystemManagersDirector.hpp" #include "GameSystems.hpp" +#include "NitworkServer.hpp" #include "ResourcesManager.hpp" #include "WaveSystem.hpp" #include "init.hpp"