QTfrontend/newnetclient.cpp
changeset 383 09a8795105a4
parent 382 e7220e48ead1
child 391 e7565bb852a2
--- a/QTfrontend/newnetclient.cpp	Sat Feb 03 21:40:50 2007 +0000
+++ b/QTfrontend/newnetclient.cpp	Sun Feb 04 14:35:28 2007 +0000
@@ -32,7 +32,8 @@
   config(config),
   m_pGameCFGWidget(pGameCFGWidget),
   m_pTeamSelWidget(pTeamSelWidget),
-  isChief(false)
+  isChief(false),
+  m_game_connected(false)
 {
   connect(&NetSocket, SIGNAL(readyRead()), this, SLOT(ClientRead()));
   connect(&NetSocket, SIGNAL(connected()), this, SLOT(OnConnect()));
@@ -50,7 +51,7 @@
 
 void HWNewNet::Disconnect()
 {
-  NetSocket.disconnect();
+  NetSocket.disconnectFromHost();
 }
 
 void HWNewNet::JoinGame(const QString & game)
@@ -123,7 +124,8 @@
 void HWNewNet::OnDisconnect()
 {
   //emit ChangeInTeams(QStringList());
-  emit Disconnected();
+  if(m_game_connected) emit Disconnected();
+  m_game_connected=false;
 }
 
 void HWNewNet::displayError(QAbstractSocket::SocketError socketError)
@@ -158,6 +160,7 @@
   }
 
   if (lst[0] == "CONNECTED") {
+    m_game_connected=true;
     emit Connected();
     emit EnteredGame();
     return;