]> git.jsancho.org Git - lugaru.git/blobdiff - Source/Account.h
Account active is now stored as an integer to avoid weird loops to find the right id
[lugaru.git] / Source / Account.h
index f5b91f1e869cbc2d43566b4d5e7f30c21d6ca54c..dcaba951469fc03afdbacd556d1792775b31a8a1 100644 (file)
@@ -43,13 +43,16 @@ struct CampaignProgress {
 class Account
 {
 public:
-    static void destroy(int i);
-    static Account* destroy(Account* a);
-    static Account* add(const std::string& name);
+    static void destroyActive();
+    static void setActive(int i);
+    static void add(const std::string& name);
     static Account* get(int i);
-    static Account* loadFile(std::string filename);
-    static void saveFile(std::string filename, Account* accountactive);
-    static int indice(Account* a);
+    static void loadFile(std::string filename);
+    static void saveFile(std::string filename);
+    static int getNbAccounts();
+
+    static bool hasActive();
+    static Account& active();
 
     void endGame();
     void winCampaignLevel(int choice, float score, float time);
@@ -105,10 +108,11 @@ public:
     };
     void setCurrentCampaign(const std::string& name);
 
-    static int getNbAccounts() {
-        return accounts.size();
-    };
 private:
+    //statics
+    static std::vector<Account*> accounts;
+    static int i_active;
+
     Account(const std::string& name = "");
     int difficulty;
     int progress; // progress in challenge levels
@@ -120,9 +124,6 @@ private:
 
     std::string currentCampaign;
     std::map<std::string, CampaignProgress> campaignProgress;
-
-    //statics
-    static std::vector<Account*> accounts;
 };
 
 #endif