Fix map preview desync
authorunC0Rr
Sun, 02 Nov 2014 23:36:01 +0300
changeset 10463 987ac036c453
parent 10457 482c744b272c
child 10465 79fe4266b2ca
Fix map preview desync
QTfrontend/ui/widget/mapContainer.cpp
project_files/hedgewars.pro
--- a/QTfrontend/ui/widget/mapContainer.cpp	Thu Oct 30 18:47:51 2014 -0400
+++ b/QTfrontend/ui/widget/mapContainer.cpp	Sun Nov 02 23:36:01 2014 +0300
@@ -544,19 +544,24 @@
     {
         mapgen = m;
 
+        bool f = false;
         switch (m)
         {
             case MAPGEN_REGULAR:
                 m_mapInfo.type = MapModel::GeneratedMap;
+                f = true;
                 break;
             case MAPGEN_MAZE:
                 m_mapInfo.type = MapModel::GeneratedMaze;
+                f = true;
                 break;
             case MAPGEN_PERLIN:
                 m_mapInfo.type = MapModel::GeneratedPerlin;
+                f = true;
                 break;
             case MAPGEN_DRAWN:
                 m_mapInfo.type = MapModel::HandDrawnMap;
+                f = true;
                 break;
             case MAPGEN_MAP:
                 switch (m_mapInfo.type)
@@ -572,7 +577,8 @@
                 break;
         }
 
-        emit mapgenChanged(m);
+        if(f)
+            changeMapType(m_mapInfo.type, QModelIndex());
     }
 }
 
@@ -873,11 +879,8 @@
         mapList->scrollTo(map);
     }
 
-    if (map.data(Qt::UserRole + 1).canConvert<MapModel::MapInfo>())
-        setMapInfo(map.data(Qt::UserRole + 1).value<MapModel::MapInfo>());
-    else
-        Q_ASSERT(false); // Houston, we have a problem.
-
+    Q_ASSERT(map.data(Qt::UserRole + 1).canConvert<MapModel::MapInfo>()); // Houston, we have a problem.
+    setMapInfo(map.data(Qt::UserRole + 1).value<MapModel::MapInfo>());
 }
 
 void HWMapContainer::setMapInfo(MapModel::MapInfo mapInfo)
--- a/project_files/hedgewars.pro	Thu Oct 30 18:47:51 2014 -0400
+++ b/project_files/hedgewars.pro	Sun Nov 02 23:36:01 2014 +0300
@@ -251,7 +251,7 @@
 
 RESOURCES += ../QTfrontend/hedgewars.qrc
 
-LIBS += -L../bin -lhwphysfs -lphyslayer
+LIBS += -L../bin -lphysfs -lphyslayer
 
 macx {
     QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6