From a177a8700f2d411624bd577c540743e7ddab57aa Mon Sep 17 00:00:00 2001 From: Github Actions Date: Thu, 2 Nov 2023 20:26:33 +0000 Subject: [PATCH 1/3] FORMAT-AUTO: automatic format on pull request #140 --- .../Menus/CreateLobby/CreateLobbySystems.cpp | 8 +++-- .../Systems/Menus/Menu/ButtonCallbacks.hpp | 36 +++++++++---------- src/Client/Systems/Menus/Menu/Menu.cpp | 5 +-- src/Client/Systems/Menus/Menu/Menu.hpp | 3 +- src/Client/Systems/Menus/Menu/MenuSystems.cpp | 6 ++-- .../Menus/SelectLobby/SelectLobbySystems.cpp | 10 ++++-- 6 files changed, 38 insertions(+), 30 deletions(-) diff --git a/src/Client/Systems/Menus/CreateLobby/CreateLobbySystems.cpp b/src/Client/Systems/Menus/CreateLobby/CreateLobbySystems.cpp index 6c0a9c05..c1053938 100644 --- a/src/Client/Systems/Menus/CreateLobby/CreateLobbySystems.cpp +++ b/src/Client/Systems/Menus/CreateLobby/CreateLobbySystems.cpp @@ -22,7 +22,6 @@ namespace Systems { namespace CreateLobby { - void initCreateLobby(std::size_t managerId, std::size_t systemId) { if (Scene::SceneManager::getInstance().getCurrentScene() != Scene::Scene::CREATE_LOBBY) { @@ -30,8 +29,11 @@ namespace Systems { return; } try { - nlohmann::json jsonData = Json::getInstance().getDataByJsonType("createLobbyMenu", JsonType::CREATE_LOBBY); - ::Menu::MenuBuilder::getInstance().initMenuSceneEntity(Json::getInstance().getDatasFromList(jsonData)); + nlohmann::json jsonData = Json::getInstance().getDataByJsonType( + "createLobbyMenu", + JsonType::CREATE_LOBBY); + ::Menu::MenuBuilder::getInstance().initMenuSceneEntity( + Json::getInstance().getDatasFromList(jsonData)); } catch (const std::exception &err) { Logger::error( "Counldn't load menu correctly, verify your json data : " + std::string(err.what())); diff --git a/src/Client/Systems/Menus/Menu/ButtonCallbacks.hpp b/src/Client/Systems/Menus/Menu/ButtonCallbacks.hpp index f9529fee..b8905b36 100644 --- a/src/Client/Systems/Menus/Menu/ButtonCallbacks.hpp +++ b/src/Client/Systems/Menus/Menu/ButtonCallbacks.hpp @@ -7,8 +7,8 @@ #pragma once -#include #include +#include #include "Json.hpp" namespace Menu { @@ -27,15 +27,15 @@ namespace Menu { NLOHMANN_JSON_SERIALIZE_ENUM( CallbackType, - { - {DEFAULT_CALLBACK, nullptr}, - {INIT_CONNECTION, "initConnection"}, - {CONNECT, "connectLobbySelected"}, - {CREATE, "onButtonGoToCreateLobbyClicked"}, - {GO_BACK, "goBackPage"}, - {GO_NEXT, "goNextPage"}, - {GO_SELECT_LOBBY, "goToSelectLobby"}, - {CREATE_NORMAL, "onButtonCreateLobbyNormalClicked"} + { + {DEFAULT_CALLBACK, nullptr }, + {INIT_CONNECTION, "initConnection" }, + {CONNECT, "connectLobbySelected" }, + {CREATE, "onButtonGoToCreateLobbyClicked" }, + {GO_BACK, "goBackPage" }, + {GO_NEXT, "goNextPage" }, + {GO_SELECT_LOBBY, "goToSelectLobby" }, + {CREATE_NORMAL, "onButtonCreateLobbyNormalClicked"} }); void initConnection(); @@ -55,14 +55,14 @@ namespace Menu { void onButtonCreateLobbyNormalClicked(); const std::unordered_map> callbacks = { - {CallbackType::DEFAULT_CALLBACK, &defaultCallBack}, - {CallbackType::INIT_CONNECTION, &initConnection}, - {CallbackType::CONNECT, &connectLobbySelected}, - {CallbackType::CREATE, &onButtonGotoCreateLobbyClicked}, - {CallbackType::GO_SELECT_LOBBY, &gotToSelectLobby}, - {CallbackType::GO_BACK, &goBackPage}, - {CallbackType::GO_NEXT, &goNextPage}, - {CallbackType::CREATE_NORMAL, &onButtonCreateLobbyNormalClicked} + {CallbackType::DEFAULT_CALLBACK, &defaultCallBack }, + {CallbackType::INIT_CONNECTION, &initConnection }, + {CallbackType::CONNECT, &connectLobbySelected }, + {CallbackType::CREATE, &onButtonGotoCreateLobbyClicked }, + {CallbackType::GO_SELECT_LOBBY, &gotToSelectLobby }, + {CallbackType::GO_BACK, &goBackPage }, + {CallbackType::GO_NEXT, &goNextPage }, + {CallbackType::CREATE_NORMAL, &onButtonCreateLobbyNormalClicked} }; } // namespace Callback diff --git a/src/Client/Systems/Menus/Menu/Menu.cpp b/src/Client/Systems/Menus/Menu/Menu.cpp index 337fca69..1da4f033 100644 --- a/src/Client/Systems/Menus/Menu/Menu.cpp +++ b/src/Client/Systems/Menus/Menu/Menu.cpp @@ -205,7 +205,8 @@ namespace Menu { if (elem.is_array()) { throw std::runtime_error("Error while loading entity : data is array"); } - std::function callback = Callback::callbacks.at(elem["callback"].get()); + std::function callback = + Callback::callbacks.at(elem["callback"].get()); switch (Json::getInstance().getDataFromJson(elem, "type")) { case ObjectType::BUTTON: return (initButton(elem, callback)); @@ -225,7 +226,7 @@ namespace Menu { } catch (std::runtime_error &err) { Logger::error( "Counldn't load menu correctly, verify your json data : " + std::string(err.what())); - throw std::runtime_error("Cannot load scene menu correctly."); + throw std::runtime_error("Cannot load scene menu correctly."); } } } diff --git a/src/Client/Systems/Menus/Menu/Menu.hpp b/src/Client/Systems/Menus/Menu/Menu.hpp index 5072c594..a1a81d06 100644 --- a/src/Client/Systems/Menus/Menu/Menu.hpp +++ b/src/Client/Systems/Menus/Menu/Menu.hpp @@ -61,8 +61,7 @@ namespace Menu { * @param callback Optional callback function for the menu entity. Defaults to * Menu::Callback::defaultCallBack. */ - std::size_t initMenuEntity( - nlohmann::json &elem); + std::size_t initMenuEntity(nlohmann::json &elem); void initMenuSceneEntity(nlohmann::json sceneMenuData); private: diff --git a/src/Client/Systems/Menus/Menu/MenuSystems.cpp b/src/Client/Systems/Menus/Menu/MenuSystems.cpp index a66f4b19..9792dd64 100644 --- a/src/Client/Systems/Menus/Menu/MenuSystems.cpp +++ b/src/Client/Systems/Menus/Menu/MenuSystems.cpp @@ -188,8 +188,10 @@ namespace Systems { return; } try { - nlohmann::json jsonData = Json::getInstance().getDataByJsonType("menu", JsonType::MENU); - ::Menu::MenuBuilder::getInstance().initMenuSceneEntity(Json::getInstance().getDatasFromList(jsonData)); + nlohmann::json jsonData = + Json::getInstance().getDataByJsonType("menu", JsonType::MENU); + ::Menu::MenuBuilder::getInstance().initMenuSceneEntity( + Json::getInstance().getDatasFromList(jsonData)); } catch (std::runtime_error &err) { Logger::info(err.what()); diff --git a/src/Client/Systems/Menus/SelectLobby/SelectLobbySystems.cpp b/src/Client/Systems/Menus/SelectLobby/SelectLobbySystems.cpp index a4df99fc..7fea3712 100644 --- a/src/Client/Systems/Menus/SelectLobby/SelectLobbySystems.cpp +++ b/src/Client/Systems/Menus/SelectLobby/SelectLobbySystems.cpp @@ -37,8 +37,10 @@ namespace Systems::SelectLobbySystems { return; } try { - nlohmann::json jsonData = Json::getInstance().getDataByJsonType("lobbyMenu", JsonType::SELECT_LOBBY); - ::Menu::MenuBuilder::getInstance().initMenuSceneEntity(Json::getInstance().getDatasFromList(jsonData)); + nlohmann::json jsonData = + Json::getInstance().getDataByJsonType("lobbyMenu", JsonType::SELECT_LOBBY); + ::Menu::MenuBuilder::getInstance().initMenuSceneEntity( + Json::getInstance().getDatasFromList(jsonData)); } catch (const std::exception &err) { Logger::error( "Counldn't load menu correctly, verify your json data : " + std::string(err.what())); @@ -74,7 +76,9 @@ namespace Systems::SelectLobbySystems { try { for (std::size_t i = 0; i < 5; i++) { - nlohmann::json lobbyBox = Json::getInstance().getDataByJsonType("inputBoxes", JsonType::SELECT_LOBBY); + nlohmann::json lobbyBox = Json::getInstance().getDataByJsonType( + "inputBoxes", + JsonType::SELECT_LOBBY); std::size_t id = ::Menu::MenuBuilder::getInstance().initMenuEntity(lobbyBox); if (arrPosition.exist(id)) { From 1d59fcfa1d901d9456e03f9c42fb627636b5f225 Mon Sep 17 00:00:00 2001 From: Desousa Brice <91657273+KitetsuK@users.noreply.github.com> Date: Thu, 2 Nov 2023 21:33:31 +0100 Subject: [PATCH 2/3] Update src/Client/Systems/Menus/CreateLobby/CreateLobbySystems.cpp Co-authored-by: Tenshi <87119012+TTENSHII@users.noreply.github.com> --- src/Client/Systems/Menus/CreateLobby/CreateLobbySystems.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Client/Systems/Menus/CreateLobby/CreateLobbySystems.cpp b/src/Client/Systems/Menus/CreateLobby/CreateLobbySystems.cpp index c1053938..529801cc 100644 --- a/src/Client/Systems/Menus/CreateLobby/CreateLobbySystems.cpp +++ b/src/Client/Systems/Menus/CreateLobby/CreateLobbySystems.cpp @@ -49,4 +49,4 @@ namespace Systems { } } // namespace CreateLobby -} // namespace Systems \ No newline at end of file +} // namespace Systems From fbfe9c62b91b3ab2adf403e71f976cfd5abd257c Mon Sep 17 00:00:00 2001 From: tenshi Date: Thu, 2 Nov 2023 22:00:55 +0100 Subject: [PATCH 3/3] CLIENT-GAME: Add space to lobby PATCH --- src/Nitwork/NitworkMainServer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Nitwork/NitworkMainServer.cpp b/src/Nitwork/NitworkMainServer.cpp index 420941b8..4b274fe5 100644 --- a/src/Nitwork/NitworkMainServer.cpp +++ b/src/Nitwork/NitworkMainServer.cpp @@ -178,12 +178,13 @@ namespace Nitwork { int ownerPort) { #ifdef _WIN32 + std::string winName = "\"" + name + "\""; std::basic_ostringstream cmdline; cmdline << _T(ECS::ResourcesManager::convertPath( "./r-type_server.exe", ECS::ResourcesManager::FileType::BINARY) .c_str()) - << _T(" 1 ") << _T(maxNbPlayer) << _T(" ") << _T(gameType) << _T(" ") << _T(name.c_str()) + << _T(" 1 ") << _T(maxNbPlayer) << _T(" ") << _T(gameType) << _T(" ") << _T(winName.c_str()) << _T(" ") << _T(ownerIp.c_str()) << _T(" ") << _T(ownerPort); Logger::fatal("cmdline: " + cmdline.str());