- Fix ConfigAsked not sending full config (leads to team divide checkbox inconsistency)
authorunc0rr
Tue, 04 Nov 2008 22:49:13 +0000
changeset 1475 bab5650fc894
parent 1474 8817adb86da6
child 1476 b3b28e99570f
- Fix ConfigAsked not sending full config (leads to team divide checkbox inconsistency) - Allow getting back from non-interactive mode
QTfrontend/frameTeam.cpp
QTfrontend/frameTeam.h
QTfrontend/newnetclient.cpp
QTfrontend/teamselect.cpp
QTfrontend/teamselect.h
QTfrontend/teamselhelper.cpp
QTfrontend/teamselhelper.h
netserver/hedgewars-server.hs
--- a/QTfrontend/frameTeam.cpp	Tue Nov 04 22:42:08 2008 +0000
+++ b/QTfrontend/frameTeam.cpp	Tue Nov 04 22:49:13 2008 +0000
@@ -44,14 +44,14 @@
 	resetColors();
 }
 
-void FrameTeams::setNonInteractive()
+void FrameTeams::setInteractivity(bool interactive)
 {
-  nonInteractive=true;
-  for(tmapTeamToWidget::iterator it=teamToWidget.begin(); it!=teamToWidget.end(); ++it) {
-    TeamShowWidget* pts=dynamic_cast<TeamShowWidget*>(it.value());
-    if(!pts) throw;
-    pts->setNonInteractive();
-  }
+	nonInteractive = !interactive;
+	for(tmapTeamToWidget::iterator it=teamToWidget.begin(); it!=teamToWidget.end(); ++it) {
+		TeamShowWidget* pts = dynamic_cast<TeamShowWidget*>(it.value());
+		if(!pts) throw;
+		pts->setInteractivity(interactive);
+	}
 }
 
 void FrameTeams::resetColors()
@@ -70,7 +70,7 @@
 void FrameTeams::addTeam(HWTeam team, bool willPlay)
 {
   TeamShowWidget* pTeamShowWidget = new TeamShowWidget(team, willPlay, this);
-  if(nonInteractive) pTeamShowWidget->setNonInteractive();
+  if(nonInteractive) pTeamShowWidget->setInteractivity(false);
 //  int hght=teamToWidget.empty() ? 0 : teamToWidget.begin()->second->size().height();
   mainLayout.addWidget(pTeamShowWidget);
   teamToWidget.insert(team, pTeamShowWidget);
--- a/QTfrontend/frameTeam.h	Tue Nov 04 22:42:08 2008 +0000
+++ b/QTfrontend/frameTeam.h	Tue Nov 04 22:49:13 2008 +0000
@@ -40,7 +40,7 @@
   void resetTeams();
   void setHHNum(const HWTeam& team);
   void setTeamColor(const HWTeam& team);
-  void setNonInteractive();
+  void setInteractivity(bool interactive);
   QColor getNextColor() const;
 
  signals:
--- a/QTfrontend/newnetclient.cpp	Tue Nov 04 22:42:08 2008 +0000
+++ b/QTfrontend/newnetclient.cpp	Tue Nov 04 22:49:13 2008 +0000
@@ -69,6 +69,7 @@
 	
 	RawSendNet(QString("CREATE%1%2").arg(delimeter).arg(room));
 	m_pGameCFGWidget->setEnabled(true);
+	m_pTeamSelWidget->setInteractivity(true);
 	isChief = true;
 }
 
@@ -84,7 +85,7 @@
 
 	RawSendNet(QString("JOIN%1%2").arg(delimeter).arg(room));
 	m_pGameCFGWidget->setEnabled(false);
-	m_pTeamSelWidget->setNonInteractive();
+	m_pTeamSelWidget->setInteractivity(false);
 	isChief = false;
 }
 
@@ -453,6 +454,7 @@
 	onInitHealthChanged(m_pGameCFGWidget->getInitHealth());
 	onTurnTimeChanged(m_pGameCFGWidget->getTurnTime());
 	onFortsModeChanged(m_pGameCFGWidget->getGameFlags() & 0x1);
+	onTeamsDivideChanged(m_pGameCFGWidget->getGameFlags() & 0x10);
 	// always initialize with default ammo (also avoiding complicated cross-class dependencies)
 	onWeaponsNameChanged("Default", cDefaultAmmoStore->mid(10));
 }
--- a/QTfrontend/teamselect.cpp	Tue Nov 04 22:42:08 2008 +0000
+++ b/QTfrontend/teamselect.cpp	Tue Nov 04 22:49:13 2008 +0000
@@ -55,9 +55,9 @@
   emit setEnabledGameStart(curPlayingTeams.size()>1);
 }
 
-void TeamSelWidget::setNonInteractive()
+void TeamSelWidget::setInteractivity(bool interactive)
 {
-  framePlaying->setNonInteractive();
+	framePlaying->setInteractivity(interactive);
 }
 
 void TeamSelWidget::hhNumChanged(const HWTeam& team)
--- a/QTfrontend/teamselect.h	Tue Nov 04 22:42:08 2008 +0000
+++ b/QTfrontend/teamselect.h	Tue Nov 04 22:49:13 2008 +0000
@@ -45,7 +45,7 @@
   bool isPlaying(HWTeam team) const;
   QList<HWTeam> getPlayingTeams() const;
   QList<HWTeam> getDontPlayingTeams() const;
-  void setNonInteractive();
+  void setInteractivity(bool interactive);
 
  public slots:
   void addTeam(HWTeam team);
--- a/QTfrontend/teamselhelper.cpp	Tue Nov 04 22:42:08 2008 +0000
+++ b/QTfrontend/teamselhelper.cpp	Tue Nov 04 22:49:13 2008 +0000
@@ -82,14 +82,15 @@
 	//QObject::connect(bText, SIGNAL(clicked()), this, SLOT(activateTeam()));
 }
 
-void TeamShowWidget::setNonInteractive()
+void TeamShowWidget::setInteractivity(bool interactive)
 {
-  if(m_team.isNetTeam()) {
-    disconnect(butt, SIGNAL(clicked()));
-   // disconnect(bText, SIGNAL(clicked()));
-  }
-  disconnect(colorButt, SIGNAL(clicked()), this, SLOT(changeTeamColor()));
-  phhoger->setNonInteractive();
+	if(m_team.isNetTeam()) {
+		butt->setEnabled(interactive);
+	}
+	
+	colorButt->setEnabled(interactive);
+	//phhoger->setNonInteractive();
+	phhoger->setEnabled(interactive);
 }
 
 void TeamShowWidget::setHHNum(unsigned int num)
--- a/QTfrontend/teamselhelper.h	Tue Nov 04 22:42:08 2008 +0000
+++ b/QTfrontend/teamselhelper.h	Tue Nov 04 22:49:13 2008 +0000
@@ -57,7 +57,7 @@
  TeamShowWidget(HWTeam team, bool isPlaying, QWidget * parent);
  void setPlaying(bool isPlaying);
  void setHHNum(unsigned int num);
- void setNonInteractive();
+ void setInteractivity(bool interactive);
  HWTeam getTeam() const;
 
  private:
--- a/netserver/hedgewars-server.hs	Tue Nov 04 22:42:08 2008 +0000
+++ b/netserver/hedgewars-server.hs	Tue Nov 04 22:49:13 2008 +0000
@@ -57,7 +57,7 @@
 sendAnswers [] _ clients _ = return clients
 sendAnswers ((handlesFunc, answer):answers) client clients rooms = do
 	let recipients = handlesFunc client clients rooms
-	--unless (null recipients) $ putStrLn ("< " ++ (show answer))
+	unless (null recipients) $ putStrLn ("< " ++ (show answer))
 
 	clHandles' <- forM recipients $
 		\ch -> Control.Exception.handle