QTfrontend/netserver.cpp
changeset 317 e95340dbfc1d
parent 315 73003488240b
child 319 7f3bd9e31f18
--- a/QTfrontend/netserver.cpp	Thu Jan 11 20:45:59 2007 +0000
+++ b/QTfrontend/netserver.cpp	Thu Jan 11 22:04:08 2007 +0000
@@ -73,6 +73,14 @@
   return ds_port;
 }
 
+bool HWNetServer::isCheefClient(HWConnectedClient* cl) const
+{
+  for(QList<HWConnectedClient*>::const_iterator it=connclients.begin(); it!=connclients.end(); ++it) {
+    if((*it)->getClientNick()!="" && *it==cl)  return true;
+  }
+  return false;
+}
+
 bool HWNetServer::haveNick(const QString& nick) const
 {
   for(QList<HWConnectedClient*>::const_iterator it=connclients.begin(); it!=connclients.end(); ++it) {
@@ -123,6 +131,13 @@
   return msg;
 }
 
+void HWNetServer::startAll(QString gameCfg)
+{
+  for(QList<HWConnectedClient*>::iterator it=connclients.begin(); it!=connclients.end(); ++it) {
+    (*it)->RawSendNet(gameCfg);
+  }
+}
+
 HWConnectedClient::HWConnectedClient(HWNetServer* hwserver, QTcpSocket* client) :
   readyToStart(false),
   m_hwserver(hwserver),
@@ -172,6 +187,7 @@
     qDebug() << "send connected";
     RawSendNet(QString("CONNECTED"));
     m_hwserver->teamChanged();
+    if(m_hwserver->isCheefClient(this)) RawSendNet(QString("CONFIGASKED"));
     return;
   }
   if(client_nick=="") return;
@@ -180,14 +196,14 @@
     readyToStart=true;
     if(m_hwserver->shouldStart(this)) {
       // start
-      RawSendNet(QString("CONFIGASKED"));
+      m_hwserver->startAll(QString("CONFIGURED")+delimeter+m_hwserver->prepareConfig(gameCfg)+delimeter+"!"+delimeter);
     }
     return;
   }
 
   if(lst[0]=="CONFIGANSWER") {
     lst.pop_front();
-    RawSendNet(QString("CONFIGURED")+QString(delimeter)+m_hwserver->prepareConfig(lst)+delimeter+"!"+delimeter);
+    gameCfg=lst;
     return;
   }