96 return getChiefClient()==cl; |
96 return getChiefClient()==cl; |
97 } |
97 } |
98 |
98 |
99 QMap<QString, QStringList> HWNetServer::getGameCfg() const |
99 QMap<QString, QStringList> HWNetServer::getGameCfg() const |
100 { |
100 { |
|
101 return m_gameCfg; |
|
102 /* |
101 for(QList<HWConnectedClient*>::const_iterator it=connclients.begin(); it!=connclients.end(); ++it) { |
103 for(QList<HWConnectedClient*>::const_iterator it=connclients.begin(); it!=connclients.end(); ++it) { |
102 if(isChiefClient(*it)) { |
104 if(isChiefClient(*it)) { |
103 return (*it)->m_gameCfg; |
105 return (*it)->m_gameCfg; |
104 } |
106 } |
105 } |
107 } |
106 // error happened if we are here |
108 // error happened if we are here |
107 return QMap<QString, QStringList>(); |
109 return QMap<QString, QStringList>(); |
|
110 */ |
108 } |
111 } |
109 |
112 |
110 bool HWNetServer::haveNick(const QString& nick) const |
113 bool HWNetServer::haveNick(const QString& nick) const |
111 { |
114 { |
112 for(QList<HWConnectedClient*>::const_iterator it=connclients.begin(); it!=connclients.end(); ++it) { |
115 for(QList<HWConnectedClient*>::const_iterator it=connclients.begin(); it!=connclients.end(); ++it) { |
248 return; |
251 return; |
249 } |
252 } |
250 |
253 |
251 if(lst[0]=="CONFIG_PARAM") { |
254 if(lst[0]=="CONFIG_PARAM") { |
252 if(!m_hwserver->isChiefClient(this) || lst.size()<3) return; // error or permission denied :) |
255 if(!m_hwserver->isChiefClient(this) || lst.size()<3) return; // error or permission denied :) |
253 else m_gameCfg[lst[1]]=lst.mid(2); |
256 else m_hwserver->m_gameCfg[lst[1]]=lst.mid(2); |
254 qDebug() << msg; |
257 qDebug() << msg; |
255 } |
258 } |
256 |
259 |
257 if(lst[0]=="ADDTEAM:") { |
260 if(lst[0]=="ADDTEAM:") { |
258 if(lst.size()<11) return; |
261 if(lst.size()<11) return; |
276 QString colorCfg=QString("CONFIG_PARAM%1TEAM_COLOR+%2+%3%1%4").arg(delimeter).arg(lst[0])\ |
279 QString colorCfg=QString("CONFIG_PARAM%1TEAM_COLOR+%2+%3%1%4").arg(delimeter).arg(lst[0])\ |
277 .arg(netTeamID)\ |
280 .arg(netTeamID)\ |
278 .arg(lst.takeAt(2)); |
281 .arg(lst.takeAt(2)); |
279 qDebug() << "color config:" << colorCfg; |
282 qDebug() << "color config:" << colorCfg; |
280 |
283 |
281 m_gameCfg[colorCfg.split(delimeter)[1]]=colorCfg.split(delimeter).mid(2); |
284 m_hwserver->m_gameCfg[colorCfg.split(delimeter)[1]]=colorCfg.split(delimeter).mid(2); |
282 m_gameCfg[hhnumCfg.split(delimeter)[1]]=hhnumCfg.split(delimeter).mid(2); |
285 m_hwserver->m_gameCfg[hhnumCfg.split(delimeter)[1]]=hhnumCfg.split(delimeter).mid(2); |
283 m_teamsCfg.push_back(lst); |
286 m_teamsCfg.push_back(lst); |
284 |
287 |
285 m_hwserver->sendOthers(this, QString("ADDTEAM:")+delimeter+lst.join(QString(delimeter))); |
288 m_hwserver->sendOthers(this, QString("ADDTEAM:")+delimeter+lst.join(QString(delimeter))); |
286 RawSendNet(QString("TEAM_ACCEPTED%1%2%1%3").arg(delimeter).arg(lst[0]).arg(lst[1])); |
289 RawSendNet(QString("TEAM_ACCEPTED%1%2%1%3").arg(delimeter).arg(lst[0]).arg(lst[1])); |
|
290 m_hwserver->sendAll(colorCfg); |
287 m_hwserver->sendAll(hhnumCfg); |
291 m_hwserver->sendAll(hhnumCfg); |
288 return; |
292 return; |
289 } |
293 } |
290 |
294 |
291 if(lst[0]=="REMOVETEAM:") { |
295 if(lst[0]=="REMOVETEAM:") { |
292 if(lst.size()<2) return; |
296 if(lst.size()<2) return; |
293 |
297 |
294 for(QMap<QString, QStringList>::iterator it=m_gameCfg.begin(); it!=m_gameCfg.end(); ++it) { |
298 for(QMap<QString, QStringList>::iterator it=m_hwserver->m_gameCfg.begin(); it!=m_hwserver->m_gameCfg.end(); ++it) { |
295 QStringList hhTmpList=it.key().split('+'); |
299 QStringList hhTmpList=it.key().split('+'); |
296 if(hhTmpList[0] == "HHNUM") { |
300 if(hhTmpList[0] == "HHNUM") { |
297 qDebug() << "hhnum config found"; |
301 qDebug() << "hhnum config found"; |
298 if(hhTmpList[1]==lst[1]) { |
302 if(hhTmpList[1]==lst[1]) { |
299 qDebug() << "hhnum config team found with: " << lst[1] << ":" << it.value()[0].toUInt(); |
303 qDebug() << "hhnum config team found with: " << lst[1] << ":" << it.value()[0].toUInt(); |