X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FAccount.cpp;h=354713570c9ea43522b8cca03ca3fa403302b6e0;hb=26debbd380c6922e5a0b60d99567c6374a4fef9a;hp=beb5f46a041787aae4e675b1588de9449ab21584;hpb=a2c433c31cd6ee454ace7f582375c6002dfba732;p=lugaru.git diff --git a/Source/Account.cpp b/Source/Account.cpp index beb5f46..3547135 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(); } @@ -126,7 +122,7 @@ Account* Account::loadFile(string filename) { funpackf(tfile, "Bi", &(acc->progress)); int nbCampaigns; funpackf(tfile, "Bi", &nbCampaigns); - printf("loading %d campaign progress info\n",nbCampaigns); + //~ printf("loading %d campaign progress info\n",nbCampaigns); for(int k=0;kcampaignProgress[campaignName].time)); funpackf(tfile, "Bf", &(acc->campaignProgress[campaignName].score)); funpackf(tfile, "Bf", &(acc->campaignProgress[campaignName].fasttime)); @@ -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++) {