fix for frontend desync
authorprg
Wed, 24 Nov 2010 20:36:46 -0500
changeset 4419 3d99c2c806ec
parent 4418 c4ce66435305
child 4420 6be946bcd17a
fix for frontend desync
QTfrontend/hwmap.h
QTfrontend/mapContainer.cpp
--- a/QTfrontend/hwmap.h	Wed Nov 24 16:41:35 2010 -0500
+++ b/QTfrontend/hwmap.h	Wed Nov 24 20:36:46 2010 -0500
@@ -31,6 +31,7 @@
 {
     MAPGEN_REGULAR,
     MAPGEN_MAZE,
+    MAPGEN_LAST
 };
 
 class HWMap : public TCPBase
--- a/QTfrontend/mapContainer.cpp	Wed Nov 24 16:41:35 2010 -0500
+++ b/QTfrontend/mapContainer.cpp	Wed Nov 24 20:36:46 2010 -0500
@@ -370,7 +370,8 @@
 void HWMapContainer::setSeed(const QString & seed)
 {
     m_seed = seed;
-    changeImage();
+    if (chooseMap->currentIndex() < MAPGEN_LAST)
+        changeImage();
 }
 
 void HWMapContainer::setMap(const QString & map)
@@ -410,11 +411,11 @@
 #include <QMessageBox>
 void HWMapContainer::setRandomMap()
 {
+    setRandomSeed();
     switch(chooseMap->currentIndex())
     {
     case MAPGEN_REGULAR:
     case MAPGEN_MAZE:
-        setRandomSeed();
         setRandomTheme();
         break;
     default:
@@ -429,20 +430,21 @@
 void HWMapContainer::setRandomStatic()
 {
     chooseMap->setCurrentIndex(4 + numMissions + rand() % (chooseMap->count() - 4 - numMissions));
-    m_seed = QUuid::createUuid().toString();
+    setRandomSeed();
 }
 
 void HWMapContainer::setRandomMission()
 {
     chooseMap->setCurrentIndex(3 + rand() % numMissions);
-    m_seed = QUuid::createUuid().toString();
+    setRandomSeed();
 }
 
 void HWMapContainer::setRandomSeed()
 {
     m_seed = QUuid::createUuid().toString();
     emit seedChanged(m_seed);
-    changeImage();
+    if (chooseMap->currentIndex() < MAPGEN_LAST)
+        changeImage();
 }
 
 void HWMapContainer::setRandomTheme()