2 Copyright (C) 2003, 2010 - Wolfire Games
3 Copyright (C) 2010-2016 - Lugaru contributors (see AUTHORS file)
5 This file is part of Lugaru.
7 Lugaru is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 Lugaru is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with Lugaru. If not, see <http://www.gnu.org/licenses/>.
29 struct CampaignProgress {
34 std::vector<int> choices;
46 static void destroyActive();
47 static void setActive(int i);
48 static void add(const std::string& name);
49 static Account& get(int i);
50 static void loadFile(std::string filename);
51 static void saveFile(std::string filename);
52 static int getNbAccounts();
54 static bool hasActive();
55 static Account& active();
57 Account(const std::string& name = "");
61 void winCampaignLevel(int choice, float score, float time);
62 void winLevel(int level, float score, float time);
66 void setDifficulty(int i) {
69 const std::string& getName() {
72 float getCampaignScore() {
73 return campaignProgress[currentCampaign].score;
75 int getCampaignChoicesMade() {
76 return campaignProgress[currentCampaign].choices.size();
78 int getCampaignChoice(int i) {
79 return campaignProgress[currentCampaign].choices[i];
81 void setCampaignScore(int s) {
82 campaignProgress[currentCampaign].score = s;
83 if (s > campaignProgress[currentCampaign].highscore)
84 campaignProgress[currentCampaign].highscore = s;
86 void setCampaignFinalTime(float t) {
87 campaignProgress[currentCampaign].time = t;
88 if ((t < campaignProgress[currentCampaign].fasttime) || ((campaignProgress[currentCampaign].fasttime == 0) && (t != 0)))
89 campaignProgress[currentCampaign].fasttime = t;
91 float getCampaignFasttime() {
92 return campaignProgress[currentCampaign].fasttime;
94 void resetFasttime() {
95 campaignProgress[currentCampaign].fasttime = 0;
97 float getCampaignHighScore() {
98 return campaignProgress[currentCampaign].highscore;
100 float getHighScore(int i) {
103 float getFastTime(int i) {
109 std::string getCurrentCampaign() {
110 return currentCampaign;
112 void setCurrentCampaign(const std::string& name);
116 static std::vector<Account> accounts;
119 void save(FILE* tfile);
122 int progress; // progress in challenge levels
129 std::string currentCampaign;
130 std::map<std::string, CampaignProgress> campaignProgress;