QTfrontend/model/MapModel.cpp
changeset 8386 2aaa2995a32e
parent 8385 9e8924ff9813
child 8393 85bd6c7b2641
--- a/QTfrontend/model/MapModel.cpp	Mon Jan 14 21:17:42 2013 +0400
+++ b/QTfrontend/model/MapModel.cpp	Mon Jan 14 21:37:04 2013 +0400
@@ -49,18 +49,14 @@
     //QList<QStandardItem *> missionMaps;
     QList<QStandardItem *> mapList;
 
-    // only 2 map relate files are relevant:
-    // - the cfg file that contains the settings/info of the map
-    // - the lua file - if it exists it's a mission, otherwise it isn't
-    QFile mapLuaFile;
-    QFile mapCfgFile;
-
     // add mission/static maps to lists
     foreach (QString map, maps)
     {
-        mapCfgFile.setFileName(QString("physfs://Maps/%1/map.cfg").arg(map));
-        mapLuaFile.setFileName(QString("physfs://Maps/%1/map.lua").arg(map));
-        QSettings descSettings(QString("physfs://Maps/%1/desc.txt").arg(map), QSettings::IniFormat);
+        // only 2 map relate files are relevant:
+        // - the cfg file that contains the settings/info of the map
+        // - the lua file - if it exists it's a mission, otherwise it isn't
+        QFile mapLuaFile(QString("physfs://Maps/%1/map.lua").arg(map));
+        QFile mapCfgFile(QString("physfs://Maps/%1/map.cfg").arg(map));
 
         if (mapCfgFile.open(QFile::ReadOnly))
         {
@@ -92,6 +88,8 @@
             if (isMission)
             {
                 QString locale = HWApplication::keyboardInputLocale().name();
+
+                QSettings descSettings(QString("physfs://Maps/%1/desc.txt").arg(map), QSettings::IniFormat);
                 desc = descSettings.value(locale, QString()).toString().replace("|", "\n");
             }