Force proper map and theme reset when host delegates to you if you don't have the map or theme
authorWuzzy <Wuzzy2@mail.ru>
Mon, 19 Mar 2018 16:07:08 +0100
changeset 13256 0cfa8f6a4e80
parent 13255 7f8f2c77a9cc
child 13257 7d7eb27dab31
Force proper map and theme reset when host delegates to you if you don't have the map or theme
QTfrontend/ui/widget/mapContainer.cpp
--- a/QTfrontend/ui/widget/mapContainer.cpp	Mon Mar 19 15:44:39 2018 +0100
+++ b/QTfrontend/ui/widget/mapContainer.cpp	Mon Mar 19 16:07:08 2018 +0100
@@ -1229,11 +1229,24 @@
         missionMapList->setVisible(master);
     }
 
-    if(m_missingMap)
+    if(master)
     {
-        // Force map type reset if host provided missing map
-        m_missingMap = false;
-        changeMapType(MapModel::GeneratedMap);
+        // Room delegation cleanup if we get room control.
+
+        if(m_missingMap)
+        {
+            // Force map type and theme reset we don't have the map
+            m_missingMap = false;
+            changeMapType(MapModel::GeneratedMap);
+            setRandomTheme();
+        }
+        else
+        {
+            // Set random theme if we don't have it
+            QModelIndexList mdl = m_themeModel->match(m_themeModel->index(0), ThemeModel::ActualNameRole, m_theme);
+            if(!mdl.size())
+                setRandomTheme();
+        }
     }
 }