# HG changeset patch # User Wuzzy # Date 1547870793 -3600 # Node ID c9d2a5a9f6bab5b97ecca67ead0ec43e67cefb16 # Parent 5132548cdb7703dc427d6840a732549e1500caea Add CowardMode team setting diff -r 5132548cdb77 -r c9d2a5a9f6ba QTfrontend/campaign.cpp --- a/QTfrontend/campaign.cpp Fri Jan 18 07:24:39 2019 +0100 +++ b/QTfrontend/campaign.cpp Sat Jan 19 05:06:33 2019 +0100 @@ -57,7 +57,15 @@ QSettings* teamfile = getCampTeamFile(campaignName, teamName); int progress = teamfile->value("Campaign " + campaignName + "/Progress", 0).toInt(); int unlockedMissions = teamfile->value("Campaign " + campaignName + "/UnlockedMissions", 0).toInt(); - if(progress>0 && unlockedMissions==0) + // The CowardMode cheat unlocks all campaign missions, + // but as "punishment", none of them will be marked as completed. + // Added to make it easier to test campaigns. + bool cheat = teamfile->value("Team/CowardMode", false).toBool(); + if(cheat) + { + return false; + } + else if(progress>0 && unlockedMissions==0) { QSettings campfile("physfs://Missions/Campaign/" + campaignName + "/campaign.ini", QSettings::IniFormat, 0); campfile.setIniCodec("UTF-8"); @@ -79,7 +87,8 @@ { QSettings* teamfile = getCampTeamFile(campaignName, teamName); bool won = teamfile->value("Campaign " + campaignName + "/Won", false).toBool(); - return won; + bool cheat = teamfile->value("Team/CowardMode", false).toBool(); + return won && !cheat; } QSettings* getCampMetaInfo() @@ -118,13 +127,18 @@ int progress = teamfile->value("Campaign " + campaignName + "/Progress", 0).toInt(); int unlockedMissions = teamfile->value("Campaign " + campaignName + "/UnlockedMissions", 0).toInt(); + bool cheat = teamfile->value("Team/CowardMode", false).toBool(); QSettings campfile("physfs://Missions/Campaign/" + campaignName + "/campaign.ini", QSettings::IniFormat, 0); campfile.setIniCodec("UTF-8"); QSettings* m_info = getCampMetaInfo(); - if(progress >= 0 && unlockedMissions == 0) + if(cheat) + { + progress = campfile.value("MissionNum", 1).toInt(); + } + if((progress >= 0 && unlockedMissions == 0) || cheat) { for(unsigned int i = progress + 1; i > 0; i--) {