]> git.jsancho.org Git - lugaru.git/blobdiff - Source/Account.cpp
Rename debug mode to dev tools
[lugaru.git] / Source / Account.cpp
index f650330a0f87bcbb3d9c456eb03488bf3fca5d88..bfaa3d4ba2aa520782726fc2b1340c1343c79676 100644 (file)
@@ -27,7 +27,7 @@ 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*>();
 
@@ -75,7 +75,7 @@ Account* Account::destroy(Account* a)
             return NULL;
         }
     }
-    printf("Unexpected error : User %s not found\n", a->getName());
+    printf("Unexpected error : User %s not found\n", a->getName().c_str());
     return accounts.front();
 }
 
@@ -100,7 +100,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)
@@ -115,6 +115,7 @@ Account* Account::loadFile(string filename)
     FILE *tfile;
     int numaccounts;
     int accountactive;
+    errno = 0;
 
     tfile = fopen(filename.c_str(), "rb" );
 
@@ -194,16 +195,16 @@ Account* Account::loadFile(string filename)
 void Account::saveFile(string filename, Account* accountactive)
 {
     FILE *tfile;
+    errno = 0;
 
     tfile = fopen(filename.c_str(), "wb" );
     if (tfile) {
-        printf("writing %d accounts :\n", getNbAccounts());
         fpackf(tfile, "Bi", getNbAccounts());
         fpackf(tfile, "Bi", indice(accountactive));
 
         for (int i = 0; i < getNbAccounts(); i++) {
             Account* a = Account::get(i);
-            printf("writing account %d/%d (%s)\n", i + 1, getNbAccounts(), a->getName());
+            printf("writing account %d/%d (%s)\n", i + 1, getNbAccounts(), a->getName().c_str());
             fpackf(tfile, "Bi", a->difficulty);
             fpackf(tfile, "Bi", a->progress);
             fpackf(tfile, "Bi", a->campaignProgress.size());