--- a/QTfrontend/frameTeam.cpp Sat Feb 03 12:42:38 2007 +0000
+++ b/QTfrontend/frameTeam.cpp Sat Feb 03 21:40:50 2007 +0000
@@ -54,6 +54,14 @@
currentColor=availableColors.begin();
}
+QColor FrameTeams::getNextColor() const
+{
+ QList<QColor>::ConstIterator nextColor=currentColor;
+ ++nextColor;
+ if (nextColor==availableColors.end()) nextColor=availableColors.begin();
+ return *nextColor;
+}
+
void FrameTeams::addTeam(HWTeam team, bool willPlay)
{
TeamShowWidget* pTeamShowWidget = new TeamShowWidget(team, willPlay, this);
--- a/QTfrontend/frameTeam.h Sat Feb 03 12:42:38 2007 +0000
+++ b/QTfrontend/frameTeam.h Sat Feb 03 21:40:50 2007 +0000
@@ -41,6 +41,7 @@
void setHHNum(const HWTeam& team);
void setTeamColor(const HWTeam& team);
void setNonInteractive();
+ QColor getNextColor() const;
signals:
void teamColorChanged(const HWTeam&);
--- a/QTfrontend/netserver.cpp Sat Feb 03 12:42:38 2007 +0000
+++ b/QTfrontend/netserver.cpp Sat Feb 03 21:40:50 2007 +0000
@@ -239,13 +239,22 @@
}
if(lst[0]=="ADDTEAM:") {
- if(lst.size()<10) return;
+ if(lst.size()<11) return;
lst.pop_front();
+
// add team ID
static unsigned int netTeamID=1;
lst.insert(1, QString::number(netTeamID++));
+ // creating color config for new team
+ QString colorCfg=QString("CONFIG_PARAM%1TEAM_COLOR%1%2%1%3%1%4").arg(delimeter).arg(lst[0])\
+ .arg(netTeamID)\
+ .arg(lst.takeAt(2));
+ qDebug() << "color config:" << colorCfg;
+
+ m_gameCfg[colorCfg.split(delimeter)[1]]=colorCfg.split(delimeter).mid(2);
m_teamsCfg.push_back(lst);
+
m_hwserver->sendOthers(this, QString("ADDTEAM:")+delimeter+lst.join(QString(delimeter)));
RawSendNet(QString("TEAM_ACCEPTED%1%2%1%3").arg(delimeter).arg(lst[0]).arg(lst[1]));
return;
--- a/QTfrontend/newnetclient.cpp Sat Feb 03 12:42:38 2007 +0000
+++ b/QTfrontend/newnetclient.cpp Sat Feb 03 21:40:50 2007 +0000
@@ -61,7 +61,9 @@
void HWNewNet::AddTeam(const HWTeam & team)
{
RawSendNet(QString("ADDTEAM:") + delimeter +
- team.TeamName + delimeter + team.HHName[0] + delimeter + team.HHName[1] + delimeter +
+ team.TeamName + delimeter +
+ team.teamColor.name() + 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]);
}
--- a/QTfrontend/teamselect.cpp Sat Feb 03 12:42:38 2007 +0000
+++ b/QTfrontend/teamselect.cpp Sat Feb 03 21:40:50 2007 +0000
@@ -224,6 +224,7 @@
void TeamSelWidget::pre_changeTeamStatus(HWTeam team)
{
+ team.teamColor=framePlaying->getNextColor();
emit acceptRequested(team);
}
--- a/QTfrontend/teamselect.h Sat Feb 03 12:42:38 2007 +0000
+++ b/QTfrontend/teamselect.h Sat Feb 03 21:40:50 2007 +0000
@@ -21,6 +21,7 @@
#include <QGroupBox>
#include <QVBoxLayout>
+#include <QColor>
#include <list>
#include <map>