teams moving order fixed
authordisplacer
Mon, 18 Sep 2006 17:56:27 +0000
changeset 152 c558957ef644
parent 151 9eb5a4cee35e
child 153 dc10da2a73f9
teams moving order fixed
QTfrontend/hwform.cpp
QTfrontend/teamselect.cpp
QTfrontend/teamselect.h
QTfrontend/teamselhelper.cpp
QTfrontend/teamselhelper.h
--- 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<HWTeam> teamslist=ui.pageMultiplayer->teamsSelect->getPlayingTeams();
+	for (list<HWTeam>::const_iterator it = teamslist.begin(); it != teamslist.end(); ++it ) {
+	  game->AddTeam(it->TeamName, ui.pageMultiplayer->teamsSelect->numHedgedogs(it->TeamName));
 	}
 	game->StartLocal();
 }
--- 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<HWTeam> TeamSelWidget::getPlayingTeams() const
 {
-  TeamShowWidget* tsw=dynamic_cast<TeamShowWidget*>(framePlaying->getTeamWidget(team));
+  return curPlayingTeams;
+}
+
+unsigned char TeamSelWidget::numHedgedogs(HWTeam team) const
+{
+  const TeamShowWidget* tsw=dynamic_cast<TeamShowWidget*>(framePlaying->getTeamWidget(team));
   if(!tsw) return 0;
   return tsw->getHedgehogsNum();
 }
--- 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<HWTeam> getPlayingTeams() const;
 
 private slots:
   void changeTeamStatus(HWTeam team);
--- 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;
 }
--- 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();