]> git.jsancho.org Git - lugaru.git/blobdiff - Source/Account.cpp
Some reorganization of MenuTick.
[lugaru.git] / Source / Account.cpp
index 31e99af8c54efcaecdcbdf601e2476dfac870321..b17d8e5596a72a48f664fc173718af7cb7d8c9da 100644 (file)
@@ -1,6 +1,6 @@
 /*
 Copyright (C) 2003, 2010 - Wolfire Games
-Copyright (C) 2010 - MCMic
+Copyright (C) 2010 - Côme <MCMic> BERNIGAUD
 
 This file is part of Lugaru.
 
@@ -37,15 +37,15 @@ Account::Account(string n) {
        difficulty = 0;
        progress = 0;
        points = 0;
-       for(int i=0;i<50;highscore[i++] = 0);
-       for(int i=0;i<50;fasttime[i++] = 0);
-       for(int i=0;i<60;unlocked[i++] = 0);
+       memset(highscore, 0, sizeof(highscore));
+       memset(fasttime, 0, sizeof(fasttime));
+       memset(unlocked, 0, sizeof(unlocked));
        campaignhighscore = 0;
        campaignfasttime = 0;
        campaignscore = 0;
        campaigntime = 0;
        campaignchoicesmade = 0;
-       for(int i=0;i<5000;campaignchoices[i++] = 0);
+       memset(campaignchoices, 0, sizeof(campaignchoices));
 }
 
 Account* Account::add(string name) {
@@ -54,7 +54,8 @@ Account* Account::add(string name) {
 }
 
 Account* Account::get(int i) {
-       if(i<accounts.size()) {
+       
+       if((i>=0)&&(i<accounts.size())) {
                return accounts[i];
        } else
                return NULL;
@@ -169,7 +170,7 @@ void Account::saveFile(string filename, Account* accountactive) {
        int numaccounts;
        int j;
        
-       tfile=fopen(ConvertFileName(filename.c_str()), "wb" );
+       tfile=fopen(ConvertFileName(filename.c_str(), "wb"), "wb" );
        if(tfile)
        {
                printf("writing %d accounts :\n",getNbAccounts());