X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FAccount.cpp;h=7eba58815332e28c4edda56ca0be8fd99c7a7c87;hb=8afdcba610cded0e54b85069ba051268b29669a6;hp=beb5f46a041787aae4e675b1588de9449ab21584;hpb=a2c433c31cd6ee454ace7f582375c6002dfba732;p=lugaru.git diff --git a/Source/Account.cpp b/Source/Account.cpp index beb5f46..7eba588 100644 --- a/Source/Account.cpp +++ b/Source/Account.cpp @@ -46,10 +46,6 @@ Account::Account(string n) : campaignProgress() { void Account::setCurrentCampaign(string name) { currentCampaign = name; - campaignProgress[name].highscore = 0; - campaignProgress[name].fasttime = 0; - campaignProgress[name].score = 0; - campaignProgress[name].time = 0; } Account* Account::add(string name) { @@ -75,7 +71,7 @@ Account* Account::destroy(Account* a) { return NULL; } } - printf("Unexpected error : User %s not found %d\n",a->getName(),a); + printf("Unexpected error : User %s not found\n",a->getName()); return accounts.front(); } @@ -156,6 +152,16 @@ Account* Account::loadFile(string filename) { } } + acc->currentCampaign = ""; + int t; + char c; + funpackf(tfile, "Bi", &t); + for(int i=0;icurrentCampaign.append(1,c); + } + funpackf(tfile, "Bf", &(acc->points)); for(int i=0;i<50;i++) { @@ -206,7 +212,7 @@ void Account::saveFile(string filename, Account* accountactive) { fpackf(tfile, "Bi", a->progress); fpackf(tfile, "Bi", a->campaignProgress.size()); - map::const_iterator it; + map::const_iterator it; for( it=a->campaignProgress.begin(); it!= a->campaignProgress.end(); ++it) { fpackf(tfile, "Bi", it->first.size()); for(j=0;jfirst.size();j++) @@ -224,6 +230,12 @@ void Account::saveFile(string filename, Account* accountactive) { } } + fpackf(tfile, "Bi", a->getCurrentCampaign().size()); + for(j=0;jgetCurrentCampaign().size();j++) + { + fpackf(tfile, "Bb", a->getCurrentCampaign()[j]); + } + fpackf(tfile, "Bf", a->points); for(j=0;j<50;j++) {