Seperate campaign victories from campaign mission victories
authorWuzzy <almikes@aol.com>
Wed, 04 May 2016 05:23:58 +0200
changeset 11956 221b38978401
parent 11955 d72a177dbaea
child 11957 1201fc039e24
Seperate campaign victories from campaign mission victories
QTfrontend/campaign.cpp
share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/campaign.ini
--- 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)
     {
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/campaign.ini	Wed May 04 04:44:41 2016 +0200
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/campaign.ini	Wed May 04 05:23:58 2016 +0200
@@ -1,4 +1,4 @@
-MissionNum=5
+MissionNum=14
 ResetRetry=1
 
 [Mission 1]