Get rid of team id in client code
authorunc0rr
Wed, 08 Oct 2008 18:46:02 +0000 (2008-10-08)
changeset 1324 4b48ae1f0f53
parent 1323 d166f9069c2b
child 1325 c8994d47f41d
Get rid of team id in client code
QTfrontend/newnetclient.cpp
QTfrontend/newnetclient.h
--- a/QTfrontend/newnetclient.cpp	Wed Oct 08 18:38:54 2008 +0000
+++ b/QTfrontend/newnetclient.cpp	Wed Oct 08 18:46:02 2008 +0000
@@ -107,7 +107,6 @@
 void HWNewNet::RemoveTeam(const HWTeam & team)
 {
   RawSendNet(QString("REMOVETEAM") + delimeter + team.TeamName);
-  m_networkToLocalteams.remove(m_networkToLocalteams.key(team.TeamName));
 }
 
 void HWNewNet::Ready()
@@ -307,7 +306,6 @@
       qWarning("Net: Bad TEAM_ACCEPTED message");
       return;
     }
-    m_networkToLocalteams.insert(lst[2].toUInt(), lst[1]);
     m_pTeamSelWidget->changeTeamStatus(lst[1]);
     return;
   }
@@ -347,22 +345,16 @@
 			emit ammoChanged(lst[3], lst[2]);
 			return;
 		}
-		QStringList hhTmpList=lst[1].split('+');
+		QStringList hhTmpList = lst[1].split('+');
 		if (hhTmpList[0] == "TEAM_COLOR") {
-			HWTeam tmptm(hhTmpList[1], hhTmpList[2].toUInt());
-			if(m_networkToLocalteams.find(hhTmpList[2].toUInt())!=m_networkToLocalteams.end()) {
-				tmptm=HWTeam(hhTmpList[1]); // local team should be changed
-			}
-			tmptm.teamColor=QColor(lst[2]);
+			HWTeam tmptm(hhTmpList[1]);
+			tmptm.teamColor = QColor(lst[2]);
 			emit teamColorChanged(tmptm);
 			return;
 		}
 		if (hhTmpList[0] == "HHNUM") {
-			HWTeam tmptm(hhTmpList[1], hhTmpList[2].toUInt());
-			if(m_networkToLocalteams.find(hhTmpList[2].toUInt())!=m_networkToLocalteams.end()) {
-				tmptm=HWTeam(hhTmpList[1]); // local team should be changed
-			}
-			tmptm.numHedgehogs=lst[2].toUInt();
+			HWTeam tmptm(hhTmpList[1]);
+			tmptm.numHedgehogs = lst[2].toUInt();
 			emit hhnumChanged(tmptm);
 			return;
 		}
@@ -410,15 +402,17 @@
 
 void HWNewNet::onHedgehogsNumChanged(const HWTeam& team)
 {
-	RawSendNet(QString("HHNUM%1%2%1%3%1%4").arg(delimeter).arg(team.TeamName)
-			.arg(team.getNetID() ? team.getNetID() : m_networkToLocalteams.key(team.TeamName))
+	RawSendNet(QString("HHNUM%1%2%1%3")
+			.arg(delimeter)
+			.arg(team.TeamName)
 			.arg(team.numHedgehogs));
 }
 
 void HWNewNet::onTeamColorChanged(const HWTeam& team)
 {
-	RawSendNet(QString("CONFIG_PARAM%1TEAM_COLOR+%2+%3%1%4").arg(delimeter).arg(team.TeamName)
-			.arg(team.getNetID() ? team.getNetID() : m_networkToLocalteams.key(team.TeamName))
+	RawSendNet(QString("CONFIG_PARAM%1TEAM_COLOR%1%2%1%3")
+			.arg(delimeter)
+			.arg(team.TeamName)
 			.arg(team.teamColor.name()));
 }
 
--- a/QTfrontend/newnetclient.h	Wed Oct 08 18:38:54 2008 +0000
+++ b/QTfrontend/newnetclient.h	Wed Oct 08 18:46:02 2008 +0000
@@ -54,8 +54,6 @@
   QString seed;
   bool m_game_connected;
 
-  QMap<unsigned int, QString> m_networkToLocalteams; // key is netID, value is local team name
-
   void ConfigAsked();
   void RunGame();