QTfrontend/newnetclient.cpp
changeset 1311 49beb1221c0b
parent 1310 4616e15d566f
child 1313 f4c54e9e1b8c
--- a/QTfrontend/newnetclient.cpp	Mon Oct 06 19:01:59 2008 +0000
+++ b/QTfrontend/newnetclient.cpp	Tue Oct 07 12:37:06 2008 +0000
@@ -51,7 +51,7 @@
 
 void HWNewNet::Disconnect()
 {
-  m_game_connected=false;
+  m_game_connected = false;
   NetSocket.disconnectFromHost();
 }
 
@@ -67,7 +67,7 @@
 
 void HWNewNet::AddTeam(const HWTeam & team)
 {
-	QString cmd = QString("ADDTEAM:") + delimeter +
+	QString cmd = QString("ADDTEAM") + delimeter +
 	     team.TeamName + delimeter +
 	     team.teamColor.name() + delimeter +
 	     team.Grave + delimeter +
@@ -86,20 +86,20 @@
 
 void HWNewNet::RemoveTeam(const HWTeam & team)
 {
-  RawSendNet(QString("REMOVETEAM:") + delimeter + team.TeamName);
+  RawSendNet(QString("REMOVETEAM") + delimeter + team.TeamName);
   m_networkToLocalteams.remove(m_networkToLocalteams.key(team.TeamName));
 }
 
-void HWNewNet::StartGame()
+void HWNewNet::Ready()
 {
-  RawSendNet(QString("START:"));
+  RawSendNet(QString("READY"));
 }
 
 void HWNewNet::SendNet(const QByteArray & buf)
 {
   QString msg = QString(buf.toBase64());
 
-  RawSendNet(QString("GAMEMSG:%1%2").arg(delimeter).arg(msg));
+  RawSendNet(QString("GAMEMSG%1%2").arg(delimeter).arg(msg));
 }
 
 void HWNewNet::RawSendNet(const QString & str)
@@ -193,7 +193,6 @@
 	if (lst[0] == "CONNECTED") {
 		m_game_connected=true;
 		emit Connected();
-		emit EnteredGame();
 		return;
 	}
 
@@ -243,8 +242,12 @@
 			qWarning("Net: Bad JOINED message");
 			return;
 		}
+		
 		for(int i = 1; i < lst.size(); ++i)
+		{
+			if (lst[i] == mynick) emit EnteredGame();
 			emit nickAdded(lst[i]);
+		}
 		return;
 	}