diff --git a/src/Client/Systems/Menus/CreateLobby/CreateLobbySystems.cpp b/src/Client/Systems/Menus/CreateLobby/CreateLobbySystems.cpp index 6c0a9c05..529801cc 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())); @@ -47,4 +49,4 @@ namespace Systems { } } // namespace CreateLobby -} // namespace Systems \ No newline at end of file +} // namespace Systems 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 59c13301..62869d43 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)) { 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());