QTfrontend/netserver.cpp
changeset 352 4665bfe25470
parent 350 c3ccec3834e8
child 354 60e4af0a4375
--- a/QTfrontend/netserver.cpp	Sun Jan 21 19:51:02 2007 +0000
+++ b/QTfrontend/netserver.cpp	Sun Jan 21 19:53:25 2007 +0000
@@ -241,27 +241,36 @@
   if(lst[0]=="ADDTEAM:") {
     if(lst.size()<10) return;
     lst.pop_front();
+    // add team ID
+    static unsigned int netTeamID=1;
+    lst.insert(1, QString::number(netTeamID++));
+
     m_teamsCfg.push_back(lst);
-    m_hwserver->sendOthers(this, msg);
+    m_hwserver->sendOthers(this, QString("ADDTEAM:")+delimeter+lst.join(QString(delimeter)));
     return;
   }
 
   if(lst[0]=="REMOVETEAM:") {
     if(lst.size()<2) return;
-    removeTeam(lst[1]);
+    unsigned int netID=removeTeam(lst[1]);
+    m_hwserver->sendOthers(this, QString("REMOVETEAM:")+delimeter+lst[1]+delimeter+QString::number(netID));
+    return;
   }
 
   m_hwserver->sendOthers(this, msg);
 }
 
-void HWConnectedClient::removeTeam(const QString& tname)
+unsigned int HWConnectedClient::removeTeam(const QString& tname)
 {
+  unsigned int netID=0;
   for(QList<QStringList>::iterator it=m_teamsCfg.begin(); it!=m_teamsCfg.end(); ++it) {
     if((*it)[0]==tname) {
+      netID=(*it)[1].toUInt();
       m_teamsCfg.erase(it);
       break;
     }
   }
+  return netID;
 }
 
 QList<QStringList> HWConnectedClient::getTeamNames() const