2 Copyright (C) 2003, 2010 - Wolfire Games
3 Copyright (C) 2010-2017 - 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
35 std::vector<int> choices;
48 static void destroyActive();
49 static void setActive(int i);
50 static void add(const std::string& name);
51 static Account& get(int i);
52 static void loadFile(std::string filename);
53 static void saveFile(std::string filename);
54 static int getNbAccounts();
56 static bool hasActive();
57 static Account& active();
59 Account(const std::string& name = "");
63 void winCampaignLevel(int choice, int score, float time);
64 void winLevel(int level, int score, float time);
68 void setDifficulty(int i)
72 const std::string& getName()
76 int getCampaignScore()
78 return campaignProgress[currentCampaign].score;
80 int getCampaignChoicesMade()
82 return campaignProgress[currentCampaign].choices.size();
84 int getCampaignChoice(int i)
86 return campaignProgress[currentCampaign].choices[i];
88 void setCampaignScore(int s)
90 campaignProgress[currentCampaign].score = s;
91 if (s > campaignProgress[currentCampaign].highscore) {
92 campaignProgress[currentCampaign].highscore = s;
95 void setCampaignFinalTime(float t)
97 campaignProgress[currentCampaign].time = t;
98 if ((t < campaignProgress[currentCampaign].fasttime) || ((campaignProgress[currentCampaign].fasttime == 0) && (t != 0))) {
99 campaignProgress[currentCampaign].fasttime = t;
102 float getCampaignFasttime()
104 return campaignProgress[currentCampaign].fasttime;
108 campaignProgress[currentCampaign].fasttime = 0;
110 int getCampaignHighScore()
112 return campaignProgress[currentCampaign].highscore;
114 int getHighScore(int i)
118 float getFastTime(int i)
126 std::string getCurrentCampaign()
128 return currentCampaign;
130 void setCurrentCampaign(const std::string& name);
134 static std::vector<Account> accounts;
137 void save(FILE* tfile);
140 int progress; // progress in challenge levels
147 std::string currentCampaign;
148 std::map<std::string, CampaignProgress> campaignProgress;