QTfrontend/newnetclient.cpp
changeset 372 4bac77f8cd38
parent 362 b28e0dd48269
child 373 df912aab6b7e
--- a/QTfrontend/newnetclient.cpp	Sat Jan 27 14:18:33 2007 +0000
+++ b/QTfrontend/newnetclient.cpp	Sat Jan 27 17:41:08 2007 +0000
@@ -245,6 +245,15 @@
 	  emit hhnumChanged(tmptm);
 	  return;
   	}
+  	if (lst[1] == "TEAM_COLOR") {
+	  HWTeam tmptm(lst[2], lst[3].toUInt());
+	  if(m_networkToLocalteams.find(lst[3].toUInt())!=m_networkToLocalteams.end()) {
+	    tmptm=HWTeam(lst[2]); // local team should be changed
+	  }
+	  tmptm.teamColor=QColor(lst[4]);
+	  emit teamColorChanged(tmptm);
+	  return;
+  	}
   	qDebug() << "unknow config param: " << lst[1];
     return;
   }
@@ -289,6 +298,14 @@
 	     .arg(team.numHedgehogs));
 }
 
+void HWNewNet::onTeamColorChanged(const HWTeam& team)
+{
+  qDebug() << team.getNetID() << ":" << team.teamColor.name();
+  RawSendNet(QString("CONFIG_PARAM%1TEAM_COLOR%1%2%1%3%1%4").arg(delimeter).arg(team.TeamName)\
+	     .arg(team.getNetID() ? team.getNetID() : m_networkToLocalteams.key(team.TeamName))\
+	     .arg(team.teamColor.name()));
+}
+
 void HWNewNet::onSeedChanged(const QString & seed)
 {
   RawSendNet(QString("CONFIG_PARAM%1SEED%1%2").arg(delimeter).arg(seed));