]> git.jsancho.org Git - lugaru.git/blobdiff - Source/Account.cpp
Some bug fixes. Now the game remember which campaign you were playing last time.
[lugaru.git] / Source / Account.cpp
index 1388b7e0e281e4d1fa4e57ef3b0295f2a311c72e..662c0d35ea2c48832d86945ef65e48c6e3ee0b3d 100644 (file)
@@ -77,7 +77,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();
 }
 
@@ -158,6 +158,16 @@ Account* Account::loadFile(string filename) {
                                }
                        }
                        
+                       acc->currentCampaign = "";
+                       int t;
+                       char c;
+                       funpackf(tfile, "Bi",  &t);
+                       for(int i=0;i<t;i++)
+                       {
+                               funpackf(tfile, "Bb",  &c);
+                               acc->currentCampaign.append(1,c);
+                       }
+                       
                        funpackf(tfile, "Bf", &(acc->points));
                        for(int i=0;i<50;i++)
                        {
@@ -226,6 +236,12 @@ void Account::saveFile(string filename, Account* accountactive) {
                                }
                        }
                        
+                       fpackf(tfile, "Bi", a->getCurrentCampaign().size());
+                       for(j=0;j<a->getCurrentCampaign().size();j++)
+                       {
+                               fpackf(tfile, "Bb", a->getCurrentCampaign()[j]);
+                       }
+                       
                        fpackf(tfile, "Bf", a->points);
                        for(j=0;j<50;j++)
                        {