]> git.jsancho.org Git - lugaru.git/blobdiff - Source/Account.cpp
Moved Account::active in Account class. Maybe it should be changed for a method and...
[lugaru.git] / Source / Account.cpp
index b3d42c7d320eb55bb120848428338baa45d7e719..d132c2123d602945454e79d7f87e7d96c3315e9e 100644 (file)
@@ -27,9 +27,10 @@ along with Lugaru.  If not, see <http://www.gnu.org/licenses/>.
 
 using namespace std;
 
-extern bool debugmode;
+extern bool devtools;
 
 vector<Account*> Account::accounts = vector<Account*>();
+Account* Account::active = nullptr;
 
 Account::Account(const string& name) : name(name), campaignProgress()
 {
@@ -100,7 +101,7 @@ void Account::winCampaignLevel(int choice, float score, float time)
 
 void Account::winLevel(int level, float score, float time)
 {
-    if (!debugmode) {
+    if (!devtools) {
         if (score > highscore[level])
             highscore[level] = score;
         if (time < fasttime[level] || fasttime[level] == 0)
@@ -114,14 +115,14 @@ Account* Account::loadFile(string filename)
 {
     FILE *tfile;
     int numaccounts;
-    int accountactive;
+    int iactive;
     errno = 0;
 
     tfile = fopen(filename.c_str(), "rb" );
 
     if (tfile) {
         funpackf(tfile, "Bi", &numaccounts);
-        funpackf(tfile, "Bi", &accountactive);
+        funpackf(tfile, "Bi", &iactive);
         printf("number of accounts %d\n", numaccounts);
         for (int i = 0; i < numaccounts; i++) {
             printf("loading account %d/%d\n", i, numaccounts);
@@ -185,14 +186,14 @@ Account* Account::loadFile(string filename)
         }
 
         fclose(tfile);
-        return get(accountactive);
+        return get(iactive);
     } else {
         perror(("Couldn't load users from " + filename).c_str());
         return NULL;
     }
 }
 
-void Account::saveFile(string filename, Account* accountactive)
+void Account::saveFile(string filename)
 {
     FILE *tfile;
     errno = 0;
@@ -200,7 +201,7 @@ void Account::saveFile(string filename, Account* accountactive)
     tfile = fopen(filename.c_str(), "wb" );
     if (tfile) {
         fpackf(tfile, "Bi", getNbAccounts());
-        fpackf(tfile, "Bi", indice(accountactive));
+        fpackf(tfile, "Bi", indice(Account::active));
 
         for (int i = 0; i < getNbAccounts(); i++) {
             Account* a = Account::get(i);