- bugfix for regression of disconnecting from server on lobby screen

This commit is contained in:
Mark Vejvoda
2010-07-02 16:54:28 +00:00
parent abb515298d
commit 521fb237bf
2 changed files with 14 additions and 13 deletions

View File

@@ -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!"; string sQuitText = Config::getInstance().getString("NetPlayerName",Socket::getHostName().c_str()) + " has chosen to leave the game!";
clientInterface->sendTextMessage(sQuitText,-1); clientInterface->sendTextMessage(sQuitText,-1);
sleep(1);
} }
clientInterface->close(); clientInterface->close();
} }
@@ -197,9 +198,8 @@ void MenuStateConnectedGame::mouseClick(int x, int y, MouseButton mouseButton){
currentMap=""; currentMap="";
returnToJoinMenu(); returnToJoinMenu();
} }
// Only allow changes after we get game settings from the server // Only allow changes after we get game settings from the server
if( clientInterface->isConnected() == true && else if( clientInterface->isConnected() == true &&
clientInterface->getGameSettingsReceived() == true) { clientInterface->getGameSettingsReceived() == true) {
if(buttonPlayNow.mouseClick(x,y) && buttonPlayNow.getEnabled()) { if(buttonPlayNow.mouseClick(x,y) && buttonPlayNow.getEnabled()) {
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__); 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__); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
} }
void MenuStateConnectedGame::returnToJoinMenu(){ void MenuStateConnectedGame::returnToJoinMenu() {
if(returnMenuInfo==jmSimple) 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)); 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)); mainMenu->setState(new MenuStateMasterserver(program, mainMenu));
} }
} }
void MenuStateConnectedGame::mouseMove(int x, int y, const MouseState *ms){ void MenuStateConnectedGame::mouseMove(int x, int y, const MouseState *ms){
buttonDisconnect.mouseMove(x, y); buttonDisconnect.mouseMove(x, y);

View File

@@ -96,6 +96,7 @@ bool NetworkInterface::isConnected(){
} }
void NetworkInterface::DisplayErrorMessage(string sErr, bool closeSocket) { 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) if(closeSocket == true && getSocket() != NULL)
{ {
@@ -111,12 +112,11 @@ void NetworkInterface::DisplayErrorMessage(string sErr, bool closeSocket) {
} }
void NetworkInterface::clearChatInfo() { 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(); if(chatTextList.size() > 0) {
//chatSender.clear(); chatTextList.clear();
//chatTeamIndex= -1; }
chatTextList.clear();
} }
std::string NetworkInterface::getIpAddress() { std::string NetworkInterface::getIpAddress() {