X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FUser%2FAccount.hpp;h=414694694edc02b113ef4dae251a8c746eb568e4;hb=6a8cb464330e92163c8feaf101b8b5837c973bba;hp=3c9e2e2f03b176ffa28966f3777ef7ae06204d7b;hpb=ed3662c0852c4312a612b4fc35bd03aba8d13db7;p=lugaru.git diff --git a/Source/User/Account.hpp b/Source/User/Account.hpp index 3c9e2e2..4146946 100644 --- a/Source/User/Account.hpp +++ b/Source/User/Account.hpp @@ -1,6 +1,6 @@ /* Copyright (C) 2003, 2010 - Wolfire Games -Copyright (C) 2010-2016 - Lugaru contributors (see AUTHORS file) +Copyright (C) 2010-2017 - Lugaru contributors (see AUTHORS file) This file is part of Lugaru. @@ -26,13 +26,15 @@ along with Lugaru. If not, see . #include #include -struct CampaignProgress { - float highscore; +struct CampaignProgress +{ + int highscore; float fasttime; - float score; + int score; float time; std::vector choices; - CampaignProgress() { + CampaignProgress() + { highscore = 0; fasttime = 0; score = 0; @@ -58,55 +60,71 @@ public: Account(FILE* tfile); void endGame(); - void winCampaignLevel(int choice, float score, float time); - void winLevel(int level, float score, float time); + void winCampaignLevel(int choice, int score, float time); + void winLevel(int level, int score, float time); // getter and setters int getDifficulty(); - void setDifficulty(int i) { + void setDifficulty(int i) + { difficulty = i; }; - const std::string& getName() { + const std::string& getName() + { return name; }; - float getCampaignScore() { + int getCampaignScore() + { return campaignProgress[currentCampaign].score; }; - int getCampaignChoicesMade() { + int getCampaignChoicesMade() + { return campaignProgress[currentCampaign].choices.size(); }; - int getCampaignChoice(int i) { + int getCampaignChoice(int i) + { return campaignProgress[currentCampaign].choices[i]; }; - void setCampaignScore(int s) { + void setCampaignScore(int s) + { campaignProgress[currentCampaign].score = s; - if (s > campaignProgress[currentCampaign].highscore) + if (s > campaignProgress[currentCampaign].highscore) { campaignProgress[currentCampaign].highscore = s; + } }; - void setCampaignFinalTime(float t) { + void setCampaignFinalTime(float t) + { campaignProgress[currentCampaign].time = t; - if ((t < campaignProgress[currentCampaign].fasttime) || ((campaignProgress[currentCampaign].fasttime == 0) && (t != 0))) + if ((t < campaignProgress[currentCampaign].fasttime) || ((campaignProgress[currentCampaign].fasttime == 0) && (t != 0))) { campaignProgress[currentCampaign].fasttime = t; + } }; - float getCampaignFasttime() { + float getCampaignFasttime() + { return campaignProgress[currentCampaign].fasttime; }; - void resetFasttime() { + void resetFasttime() + { campaignProgress[currentCampaign].fasttime = 0; }; - float getCampaignHighScore() { + int getCampaignHighScore() + { return campaignProgress[currentCampaign].highscore; }; - float getHighScore(int i) { + int getHighScore(int i) + { return highscore[i]; }; - float getFastTime(int i) { + float getFastTime(int i) + { return fasttime[i]; }; - int getProgress() { + int getProgress() + { return progress; }; - std::string getCurrentCampaign() { + std::string getCurrentCampaign() + { return currentCampaign; }; void setCurrentCampaign(const std::string& name); @@ -121,7 +139,7 @@ private: int difficulty; int progress; // progress in challenge levels float points; - float highscore[50]; + int highscore[50]; float fasttime[50]; bool unlocked[60]; std::string name;