diff --git a/source/glest_game/menu/menu_state_connected_game.cpp b/source/glest_game/menu/menu_state_connected_game.cpp index dfce018ef..33a695364 100644 --- a/source/glest_game/menu/menu_state_connected_game.cpp +++ b/source/glest_game/menu/menu_state_connected_game.cpp @@ -188,6 +188,7 @@ void MenuStateConnectedGame::mouseClick(int x, int y, MouseButton mouseButton){ { string sQuitText = Config::getInstance().getString("NetPlayerName",Socket::getHostName().c_str()) + " has chosen to leave the game!"; clientInterface->sendTextMessage(sQuitText,-1); + sleep(1); } clientInterface->close(); } @@ -197,9 +198,8 @@ void MenuStateConnectedGame::mouseClick(int x, int y, MouseButton mouseButton){ currentMap=""; returnToJoinMenu(); } - // Only allow changes after we get game settings from the server - if( clientInterface->isConnected() == true && + else if( clientInterface->isConnected() == true && clientInterface->getGameSettingsReceived() == true) { if(buttonPlayNow.mouseClick(x,y) && buttonPlayNow.getEnabled()) { SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__); @@ -257,18 +257,19 @@ void MenuStateConnectedGame::mouseClick(int x, int y, MouseButton mouseButton){ SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__); } -void MenuStateConnectedGame::returnToJoinMenu(){ - if(returnMenuInfo==jmSimple) - { +void MenuStateConnectedGame::returnToJoinMenu() { + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__); + + if(returnMenuInfo == jmSimple) { + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__); mainMenu->setState(new MenuStateJoinGame(program, mainMenu)); } - else - { + else { + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__); mainMenu->setState(new MenuStateMasterserver(program, mainMenu)); } } - void MenuStateConnectedGame::mouseMove(int x, int y, const MouseState *ms){ buttonDisconnect.mouseMove(x, y); diff --git a/source/glest_game/network/network_interface.cpp b/source/glest_game/network/network_interface.cpp index c558fdf18..32081a0e9 100644 --- a/source/glest_game/network/network_interface.cpp +++ b/source/glest_game/network/network_interface.cpp @@ -96,6 +96,7 @@ bool NetworkInterface::isConnected(){ } void NetworkInterface::DisplayErrorMessage(string sErr, bool closeSocket) { + SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] sErr [%s]\n",__FILE__,__FUNCTION__,__LINE__,sErr.c_str()); if(closeSocket == true && getSocket() != NULL) { @@ -111,12 +112,11 @@ void NetworkInterface::DisplayErrorMessage(string sErr, bool closeSocket) { } void NetworkInterface::clearChatInfo() { - SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); + SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] chatTextList.size() = %d\n",__FILE__,__FUNCTION__,__LINE__,chatTextList.size()); - //chatText.clear(); - //chatSender.clear(); - //chatTeamIndex= -1; - chatTextList.clear(); + if(chatTextList.size() > 0) { + chatTextList.clear(); + } } std::string NetworkInterface::getIpAddress() {