- Shut the client's tries to configure server up
authorunc0rr
Wed, 08 Oct 2008 15:53:23 +0000
changeset 1318 18da1c5e960d
parent 1317 13cf8c5a7428
child 1319 fedaae857a50
- Shut the client's tries to configure server up - Fix a bug which led to "different maps generated" when server changes map, but theme doesn't get changed
QTfrontend/mapContainer.cpp
QTfrontend/mapContainer.h
QTfrontend/newnetclient.cpp
--- a/QTfrontend/mapContainer.cpp	Wed Oct 08 15:42:09 2008 +0000
+++ b/QTfrontend/mapContainer.cpp	Wed Oct 08 15:53:23 2008 +0000
@@ -50,6 +50,7 @@
   imageButt->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);//QSizePolicy::Minimum, QSizePolicy::Minimum);
   mainLayout.addWidget(imageButt, 0, 0, 1, 2);
   connect(imageButt, SIGNAL(clicked()), this, SLOT(setRandomSeed()));
+  connect(imageButt, SIGNAL(clicked()), this, SLOT(setRandomTheme()));
 
   chooseMap = new QComboBox(this);
   chooseMap->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
@@ -88,6 +89,7 @@
   mainLayout.setSizeConstraint(QLayout::SetFixedSize);//SetMinimumSize
 
   setRandomSeed();
+  setRandomTheme();
 }
 
 void HWMapContainer::setImage(const QImage newImage)
@@ -145,10 +147,6 @@
 	pMap = new HWMap();
 	connect(pMap, SIGNAL(ImageReceived(const QImage)), this, SLOT(setImage(const QImage)));
 	pMap->getImage(m_seed.toStdString());
-
-	if(!Themes->size()) return;
-	quint32 themeNum = rand() % Themes->size();
-	lwThemes->setCurrentRow(themeNum);
 }
 
 void HWMapContainer::themeSelected(int currentRow)
@@ -199,7 +197,6 @@
 	QList<QListWidgetItem *> items = lwThemes->findItems(theme, Qt::MatchExactly);
 	if(items.size())
 		lwThemes->setCurrentItem(items.at(0));
-	//this->theme = theme;
 }
 
 void HWMapContainer::setRandomSeed()
@@ -208,3 +205,10 @@
   emit seedChanged(m_seed);
   changeImage();
 }
+
+void HWMapContainer::setRandomTheme()
+{
+	if(!Themes->size()) return;
+	quint32 themeNum = rand() % Themes->size();
+	lwThemes->setCurrentRow(themeNum);
+}
--- a/QTfrontend/mapContainer.h	Wed Oct 08 15:42:09 2008 +0000
+++ b/QTfrontend/mapContainer.h	Wed Oct 08 15:53:23 2008 +0000
@@ -59,6 +59,7 @@
   void setImage(const QImage newImage);
   void mapChanged(int index);
   void setRandomSeed();
+  void setRandomTheme();
   void themeSelected(int currentRow);
 
  protected:
--- a/QTfrontend/newnetclient.cpp	Wed Oct 08 15:42:09 2008 +0000
+++ b/QTfrontend/newnetclient.cpp	Wed Oct 08 15:53:23 2008 +0000
@@ -440,37 +440,37 @@
 
 void HWNewNet::onSeedChanged(const QString & seed)
 {
-  RawSendNet(QString("CONFIG_PARAM%1SEED%1%2").arg(delimeter).arg(seed));
+  if (isChief) RawSendNet(QString("CONFIG_PARAM%1SEED%1%2").arg(delimeter).arg(seed));
 }
 
 void HWNewNet::onMapChanged(const QString & map)
 {
-  RawSendNet(QString("CONFIG_PARAM%1MAP%1%2").arg(delimeter).arg(map));
+  if (isChief) RawSendNet(QString("CONFIG_PARAM%1MAP%1%2").arg(delimeter).arg(map));
 }
 
 void HWNewNet::onThemeChanged(const QString & theme)
 {
-  RawSendNet(QString("CONFIG_PARAM%1THEME%1%2").arg(delimeter).arg(theme));
+  if (isChief) RawSendNet(QString("CONFIG_PARAM%1THEME%1%2").arg(delimeter).arg(theme));
 }
 
 void HWNewNet::onInitHealthChanged(quint32 health)
 {
-  RawSendNet(QString("CONFIG_PARAM%1HEALTH%1%2").arg(delimeter).arg(health));
+  if (isChief) RawSendNet(QString("CONFIG_PARAM%1HEALTH%1%2").arg(delimeter).arg(health));
 }
 
 void HWNewNet::onTurnTimeChanged(quint32 time)
 {
-  RawSendNet(QString("CONFIG_PARAM%1TURNTIME%1%2").arg(delimeter).arg(time));
+  if (isChief) RawSendNet(QString("CONFIG_PARAM%1TURNTIME%1%2").arg(delimeter).arg(time));
 }
 
 void HWNewNet::onFortsModeChanged(bool value)
 {
-  RawSendNet(QString("CONFIG_PARAM%1FORTSMODE%1%2").arg(delimeter).arg(value));
+  if (isChief) RawSendNet(QString("CONFIG_PARAM%1FORTSMODE%1%2").arg(delimeter).arg(value));
 }
 
 void HWNewNet::onWeaponsNameChanged(const QString& name, const QString& ammo)
 {
-  RawSendNet(QString("CONFIG_PARAM%1AMMO%1%2%1%3").arg(delimeter).arg(ammo).arg(name));
+  if (isChief) RawSendNet(QString("CONFIG_PARAM%1AMMO%1%2%1%3").arg(delimeter).arg(ammo).arg(name));
 }
 
 void HWNewNet::chatLineToNet(const QString& str)