Browse Source

Use account name from lobby when joining lobby game rooms

Ivan Savenko 1 year ago
parent
commit
30a3081ab4

+ 1 - 1
client/globalLobby/GlobalLobbyClient.cpp

@@ -279,7 +279,7 @@ void GlobalLobbyClient::receiveJoinRoomSuccess(const JsonNode & json)
 {
 {
 	if (json["proxyMode"].Bool())
 	if (json["proxyMode"].Bool())
 	{
 	{
-		CSH->resetStateForLobby(EStartMode::NEW_GAME, ESelectionScreen::newGame, EServerMode::LOBBY_GUEST, {});
+		CSH->resetStateForLobby(EStartMode::NEW_GAME, ESelectionScreen::newGame, EServerMode::LOBBY_GUEST, { CSH->getGlobalLobby().getAccountDisplayName() });
 		CSH->loadMode = ELoadMode::MULTI;
 		CSH->loadMode = ELoadMode::MULTI;
 
 
 		std::string hostname = getServerHost();
 		std::string hostname = getServerHost();

+ 4 - 2
client/globalLobby/GlobalLobbyServerSetup.cpp

@@ -11,6 +11,8 @@
 #include "StdInc.h"
 #include "StdInc.h"
 #include "GlobalLobbyServerSetup.h"
 #include "GlobalLobbyServerSetup.h"
 
 
+#include "GlobalLobbyClient.h"
+
 #include "../CGameInfo.h"
 #include "../CGameInfo.h"
 #include "../CServerHandler.h"
 #include "../CServerHandler.h"
 #include "../gui/CGuiHandler.h"
 #include "../gui/CGuiHandler.h"
@@ -125,9 +127,9 @@ void GlobalLobbyServerSetup::onGameModeChanged(int value)
 void GlobalLobbyServerSetup::onCreate()
 void GlobalLobbyServerSetup::onCreate()
 {
 {
 	if(toggleGameMode->getSelected() == 0)
 	if(toggleGameMode->getSelected() == 0)
-		CSH->resetStateForLobby(EStartMode::NEW_GAME, ESelectionScreen::newGame, EServerMode::LOBBY_HOST, {});
+		CSH->resetStateForLobby(EStartMode::NEW_GAME, ESelectionScreen::newGame, EServerMode::LOBBY_HOST, { CSH->getGlobalLobby().getAccountDisplayName() });
 	else
 	else
-		CSH->resetStateForLobby(EStartMode::LOAD_GAME, ESelectionScreen::loadGame, EServerMode::LOBBY_HOST, {});
+		CSH->resetStateForLobby(EStartMode::LOAD_GAME, ESelectionScreen::loadGame, EServerMode::LOBBY_HOST, { CSH->getGlobalLobby().getAccountDisplayName() });
 
 
 	CSH->loadMode = ELoadMode::MULTI;
 	CSH->loadMode = ELoadMode::MULTI;
 	CSH->startLocalServerAndConnect(true);
 	CSH->startLocalServerAndConnect(true);