Send hats info via net. Hats implementation complete now.
authorunc0rr
Sun, 31 Aug 2008 19:23:29 +0000
changeset 1245 d2eca4a053f5
parent 1244 87b3931c70e9
child 1246 6c6284b32d1a
Send hats info via net. Hats implementation complete now.
QTfrontend/newnetclient.cpp
QTfrontend/team.cpp
--- a/QTfrontend/newnetclient.cpp	Sun Aug 31 18:36:26 2008 +0000
+++ b/QTfrontend/newnetclient.cpp	Sun Aug 31 19:23:29 2008 +0000
@@ -67,15 +67,21 @@
 
 void HWNewNet::AddTeam(const HWTeam & team)
 {
-  RawSendNet(QString("ADDTEAM:") + delimeter +
+	QString cmd = QString("ADDTEAM:") + delimeter +
 	     team.TeamName + delimeter +
 	     team.teamColor.name() + delimeter +
 	     team.Grave + delimeter +
 	     team.Fort + delimeter +
-	     QString::number(team.difficulty) + delimeter +
-	     team.HHName[0] + delimeter + team.HHName[1] + delimeter +
-	     team.HHName[2] + delimeter + team.HHName[3] + delimeter + team.HHName[4] + delimeter +
-	     team.HHName[5] + delimeter + team.HHName[6] + delimeter + team.HHName[7]);
+	     QString::number(team.difficulty);
+
+	for(int i = 0; i < 8; ++i)
+	{
+		cmd.append(delimeter);
+		cmd.append(team.HHName[i]);
+		cmd.append(delimeter);
+		cmd.append(team.HHHat[i]);
+	}
+	RawSendNet(cmd);
 }
 
 void HWNewNet::RemoveTeam(const HWTeam & team)
@@ -190,7 +196,7 @@
   }
 
   if (lst[0] == "ADDTEAM:") {
-    if(lst.size() < 14)
+    if(lst.size() < 22)
     {
 	  qWarning("Net: Too short ADDTEAM message");
 	  return;
--- a/QTfrontend/team.cpp	Sun Aug 31 18:36:26 2008 +0000
+++ b/QTfrontend/team.cpp	Sun Aug 31 19:23:29 2008 +0000
@@ -52,14 +52,18 @@
 HWTeam::HWTeam(const QStringList& strLst) :
   numHedgehogs(4)
 {
-  // net teams are configured from QStringList
-  if(strLst.size() < 14) throw HWTeamConstructException();
-  TeamName=strLst[0];
-  m_netID=strLst[1].toUInt();
-  Grave=strLst[2];
-  Fort=strLst[3];
-  difficulty=strLst[4].toUInt();
-  for(int i = 0; i < 8; i++) HHName[i]=strLst[i+5];
+	// net teams are configured from QStringList
+	if(strLst.size() < 21) throw HWTeamConstructException();
+	TeamName=strLst[0];
+	m_netID=strLst[1].toUInt();
+	Grave=strLst[2];
+	Fort=strLst[3];
+	difficulty=strLst[4].toUInt();
+	for(int i = 0; i < 8; i++)
+	{
+		HHName[i]=strLst[i * 2 + 5];
+		HHHat[i]=strLst[i * 2 + 6];
+	}
 }
 
 HWTeam::HWTeam(quint8 num) :