QTfrontend/campaign.cpp
changeset 11958 de66192866d3
parent 11957 1201fc039e24
child 12305 d3a52e51efd4
--- a/QTfrontend/campaign.cpp	Wed May 04 07:41:46 2016 +0200
+++ b/QTfrontend/campaign.cpp	Wed May 04 08:44:53 2016 +0200
@@ -109,11 +109,9 @@
 /** Returns the localized campaign name */
 QString getRealCampName(QString & campaignName)
 {
-    QSettings* m_info = getCampMetaInfo();
-    if(m_info->contains(campaignName+".name"))
-       return m_info->value(campaignName+".name").toString();
-    else
-       return campaignName.replace(QString("_"), QString(" "));
+    QString campaignNameOrig = campaignName;
+    QString campaignNameSpaces = campaignName.replace(QString("_"), QString(" "));
+    return getCampMetaInfo()->value(campaignNameOrig+".name", campaignNameSpaces).toString();
 }
 
 QList<MissionInfo> getCampMissionList(QString & campaignName, QString & teamName)
@@ -136,9 +134,11 @@
             MissionInfo missionInfo;
             QString script = campfile.value(QString("Mission %1/Script").arg(i)).toString();
             if(!script.isNull()) {
+                missionInfo.script = script;
                 missionInfo.name = campfile.value(QString("Mission %1/Name").arg(i)).toString();
-                missionInfo.script = script;
-                missionInfo.description = m_info->value(campaignName+"-"+ script.replace(QString(".lua"),QString("")) + ".desc",
+                QString scriptPrefix = campaignName+"-"+ script.replace(QString(".lua"),QString(""));
+                missionInfo.realName = m_info->value(scriptPrefix+".name", missionInfo.name).toString();
+                missionInfo.description = m_info->value(scriptPrefix + ".desc",
                                             QObject::tr("No description available")).toString();
                 QString image = campfile.value(QString("Mission %1/Script").arg(i)).toString().replace(QString(".lua"),QString(".png"));
                 missionInfo.image = ":/res/campaign/"+campaignName+"/"+image;
@@ -155,10 +155,12 @@
             QString missionNum = QString("%1").arg(i);
             int missionNumber = teamfile->value("Campaign " + campaignName + "/Mission"+missionNum, -1).toInt();
             MissionInfo missionInfo;
-            missionInfo.name = campfile.value(QString("Mission %1/Name").arg(missionNumber)).toString();
             QString script = campfile.value(QString("Mission %1/Script").arg(missionNumber)).toString();
             missionInfo.script = script;
-            missionInfo.description = m_info->value(campaignName+"-"+ script.replace(QString(".lua"),QString("")) + ".desc",
+            missionInfo.name = campfile.value(QString("Mission %1/Name").arg(missionNumber)).toString();
+            QString scriptPrefix = campaignName+"-"+ script.replace(QString(".lua"),QString(""));
+            missionInfo.realName = m_info->value(scriptPrefix+".name", missionInfo.name).toString();
+            missionInfo.description = m_info->value(scriptPrefix + ".desc",
                                             QObject::tr("No description available")).toString();
             QString image = campfile.value(QString("Mission %1/Script").arg(missionNumber)).toString().replace(QString(".lua"),QString(".png"));
             missionInfo.image = ":/res/campaign/"+campaignName+"/"+image;