]> git.jsancho.org Git - lugaru.git/blobdiff - Source/Account.cpp
rename music1, music2, music3
[lugaru.git] / Source / Account.cpp
index 31e99af8c54efcaecdcbdf601e2476dfac870321..3556c8711b3ea93c989ec9d9c639257634c02f05 100644 (file)
@@ -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());