QTfrontend/campaign.cpp
changeset 11961 221b38978401
parent 11959 62be63822a96
child 11962 1201fc039e24
--- a/QTfrontend/campaign.cpp	Wed May 04 04:44:41 2016 +0200
+++ b/QTfrontend/campaign.cpp	Wed May 04 05:23:58 2016 +0200
@@ -55,12 +55,14 @@
 bool isMissionWon(QString & campaignName, int missionInList, QString & teamName)
 {
     QSettings* teamfile = getCampTeamFile(campaignName, teamName);
-    int won = teamfile->value("Campaign " + campaignName + "/Won", false).toBool();
     int progress = teamfile->value("Campaign " + campaignName + "/Progress", 0).toInt();
     int unlockedMissions = teamfile->value("Campaign " + campaignName + "/UnlockedMissions", 0).toInt();
     if(progress>0 and unlockedMissions==0)
     {
-        return (progress > (progress - missionInList)) || won;
+        QSettings campfile("physfs://Missions/Campaign/" + campaignName + "/campaign.ini", QSettings::IniFormat, 0);
+        campfile.setIniCodec("UTF-8");
+        int totalMissions = campfile.value("MissionNum", 1).toInt();
+        return (progress > (progress - missionInList)) || (progress >= totalMissions);
     }
     else if(unlockedMissions>0)
     {