]> git.jsancho.org Git - lugaru.git/blobdiff - Source/Account.h
Stopped using Account pointers, and removed general difficulty setting (difficulty...
[lugaru.git] / Source / Account.h
index f68c52b484e1663437e4e8f0daf1ab32f7b81b73..385c6fa5fb42aea59e9015a82a691c8518be53b5 100644 (file)
@@ -43,15 +43,19 @@ struct CampaignProgress {
 class Account
 {
 public:
-    static void destroy(int i);
-    static Account* destroy(Account* a);
-    static Account* add(const std::string& name);
-    static Account* get(int i);
-    static Account* loadFile(std::string filename);
+    static void destroyActive();
+    static void setActive(int i);
+    static void add(const std::string& name);
+    static Account& get(int i);
+    static void loadFile(std::string filename);
     static void saveFile(std::string filename);
-    static int indice(Account* a);
+    static int getNbAccounts();
 
-    static Account* active;
+    static bool hasActive();
+    static Account& active();
+
+    Account(const std::string& name = "");
+    Account(FILE* tfile);
 
     void endGame();
     void winCampaignLevel(int choice, float score, float time);
@@ -107,11 +111,13 @@ public:
     };
     void setCurrentCampaign(const std::string& name);
 
-    static int getNbAccounts() {
-        return accounts.size();
-    };
 private:
-    Account(const std::string& name = "");
+    //statics
+    static std::vector<Account> accounts;
+    static int i_active;
+
+    void save(FILE* tfile);
+
     int difficulty;
     int progress; // progress in challenge levels
     float points;
@@ -122,9 +128,6 @@ private:
 
     std::string currentCampaign;
     std::map<std::string, CampaignProgress> campaignProgress;
-
-    //statics
-    static std::vector<Account*> accounts;
 };
 
 #endif