# HG changeset patch # User displacer # Date 1158602187 0 # Node ID c558957ef64458c7da38b628b7ac4c40235796e4 # Parent 9eb5a4cee35ebb89f7cbefabab44138b1e9366a2 teams moving order fixed diff -r 9eb5a4cee35e -r c558957ef644 QTfrontend/hwform.cpp --- a/QTfrontend/hwform.cpp Mon Sep 18 17:37:22 2006 +0000 +++ b/QTfrontend/hwform.cpp Mon Sep 18 17:56:27 2006 +0000 @@ -258,11 +258,9 @@ void HWForm::StartMPGame() { game = new HWGame(config, ui.pageMultiplayer->gameCFG); - QStringList teamslist = config->GetTeamsList(); - for (QStringList::Iterator it = teamslist.begin(); it != teamslist.end(); ++it ) { - if(ui.pageMultiplayer->teamsSelect->isPlaying(*it)) { - game->AddTeam(*it, ui.pageMultiplayer->teamsSelect->numHedgedogs(*it)); - } + list teamslist=ui.pageMultiplayer->teamsSelect->getPlayingTeams(); + for (list::const_iterator it = teamslist.begin(); it != teamslist.end(); ++it ) { + game->AddTeam(it->TeamName, ui.pageMultiplayer->teamsSelect->numHedgedogs(it->TeamName)); } game->StartLocal(); } diff -r 9eb5a4cee35e -r c558957ef644 QTfrontend/teamselect.cpp --- a/QTfrontend/teamselect.cpp Mon Sep 18 17:37:22 2006 +0000 +++ b/QTfrontend/teamselect.cpp Mon Sep 18 17:56:27 2006 +0000 @@ -97,14 +97,19 @@ } } -bool TeamSelWidget::isPlaying(HWTeam team) +bool TeamSelWidget::isPlaying(HWTeam team) const { return std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team)!=curPlayingTeams.end(); } -unsigned char TeamSelWidget::numHedgedogs(HWTeam team) +list TeamSelWidget::getPlayingTeams() const { - TeamShowWidget* tsw=dynamic_cast(framePlaying->getTeamWidget(team)); + return curPlayingTeams; +} + +unsigned char TeamSelWidget::numHedgedogs(HWTeam team) const +{ + const TeamShowWidget* tsw=dynamic_cast(framePlaying->getTeamWidget(team)); if(!tsw) return 0; return tsw->getHedgehogsNum(); } diff -r 9eb5a4cee35e -r c558957ef644 QTfrontend/teamselect.h --- a/QTfrontend/teamselect.h Mon Sep 18 17:37:22 2006 +0000 +++ b/QTfrontend/teamselect.h Mon Sep 18 17:56:27 2006 +0000 @@ -24,8 +24,9 @@ void addTeam(HWTeam team); //void removeTeam(HWTeam team); void resetPlayingTeams(const QStringList& teamslist); - bool isPlaying(HWTeam team); - unsigned char numHedgedogs(HWTeam team); + bool isPlaying(HWTeam team) const; + unsigned char numHedgedogs(HWTeam team) const; + list getPlayingTeams() const; private slots: void changeTeamStatus(HWTeam team); diff -r 9eb5a4cee35e -r c558957ef644 QTfrontend/teamselhelper.cpp --- a/QTfrontend/teamselhelper.cpp Mon Sep 18 17:37:22 2006 +0000 +++ b/QTfrontend/teamselhelper.cpp Mon Sep 18 17:56:27 2006 +0000 @@ -48,7 +48,7 @@ emit teamStatusChanged(m_team); } -unsigned char TeamShowWidget::getHedgehogsNum() +unsigned char TeamShowWidget::getHedgehogsNum() const { return phhoger ? phhoger->getHedgehogsNum() : 0; } diff -r 9eb5a4cee35e -r c558957ef644 QTfrontend/teamselhelper.h --- a/QTfrontend/teamselhelper.h Mon Sep 18 17:37:22 2006 +0000 +++ b/QTfrontend/teamselhelper.h Mon Sep 18 17:56:27 2006 +0000 @@ -33,7 +33,7 @@ public: TeamShowWidget(HWTeam team, bool isPlaying, QWidget * parent); void setPlaying(bool isPlaying); - unsigned char getHedgehogsNum(); + unsigned char getHedgehogsNum() const; private: TeamShowWidget();