QTfrontend/mission.cpp
changeset 14546 029f40c609b4
parent 14484 bd1db668b7c0
--- a/QTfrontend/mission.cpp	Sat Jan 05 23:15:13 2019 +0100
+++ b/QTfrontend/mission.cpp	Sun Jan 06 01:21:16 2019 +0100
@@ -53,3 +53,27 @@
     bool won = teamfile->value("Mission " + missionName + "/Won", false).toBool();
     return won;
 }
+
+/**
+    Returns true if the mission value adressed with the provided
+    missionName: Name of the mission in question
+    teamName: Name of the playing team
+    key: name of key to check
+*/
+bool missionValueExists(QString & missionName, QString & teamName, QString key)
+{
+    QSettings* teamfile = getMissionTeamFile(missionName, teamName);
+    return teamfile->contains("Mission " + missionName + "/" + key);
+}
+/**
+    Returns a mission value.
+    NOTE: Check whether the mission value exists first, using missionValueExists.
+    missionName: Name of the mission in question
+    teamName: Name of the playing team
+    key: name of key to read its value from
+*/
+QVariant getMissionValue(QString & missionName, QString & teamName, QString key)
+{
+    QSettings* teamfile = getMissionTeamFile(missionName, teamName);
+    return teamfile->value("Mission " + missionName + "/" + key);
+}