X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FGameInitDispose.cpp;h=402c76113e8f21bb07c1814ba84994378d17986a;hb=cd46cab54acd39ff8c02b204844f1ce53fd2edbc;hp=9fb279bc52fb248185e73c9ff75ba664f9960c7b;hpb=963584c62f5a1ec1f2b505f5c64672b7d4bc7547;p=lugaru.git diff --git a/Source/GameInitDispose.cpp b/Source/GameInitDispose.cpp index 9fb279b..402c761 100644 --- a/Source/GameInitDispose.cpp +++ b/Source/GameInitDispose.cpp @@ -78,16 +78,6 @@ extern float slomospeed; extern char mapname[256]; extern bool gamestarted; -extern int numaccounts; -extern int accountactive; -extern int accountdifficulty[10]; -extern int accountprogress[10]; -extern float accountpoints[10]; -extern float accounthighscore[10][50]; -extern float accountfasttime[10][50]; -extern bool accountunlocked[10][60]; -extern char accountname[10][256]; - extern int numdialogues; extern int numdialogueboxes[20]; extern int dialoguetype[20]; @@ -131,59 +121,11 @@ void Game::Dispose() LOGFUNC; if(endgame==2){ - accountcampaignchoicesmade[accountactive]=0; - accountcampaignscore[accountactive]=0; - accountcampaigntime[accountactive]=0; + accountactive->endGame(); endgame=0; } - - sprintf (mapname, ":Data:Users"); - - FILE *tfile; - tfile=fopen( ConvertFileName(mapname), "wb" ); - if (tfile) - { - fpackf(tfile, "Bi", numaccounts); - fpackf(tfile, "Bi", accountactive); - if(numaccounts>0) - { - for(i=0;i0) - { - for(j=0;j<(int)strlen(accountname[i]);j++) - { - fpackf(tfile, "Bb", accountname[i][j]); - } - } - } - } - - fclose(tfile); - } + Account::saveFile(":Data:Users", accountactive); TexIter it = textures.begin(); for (; it != textures.end(); ++it) @@ -996,60 +938,7 @@ void Game::InitGame() numchallengelevels=14; - - FILE *tfile; - - accountactive=-1; - - sprintf (mapname, ":Data:Users"); - tfile=fopen( ConvertFileName(mapname), "rb" ); - if(tfile) - { - funpackf(tfile, "Bi", &numaccounts); - funpackf(tfile, "Bi", &accountactive); - if(numaccounts>0) - { - for(i=0;i= 10) - { - accountcampaignchoices[i][j] = 0; - } - } - funpackf(tfile, "Bf", &accountpoints[i]); - for(j=0;j<50;j++) - { - funpackf(tfile, "Bf", &accounthighscore[i][j]); - funpackf(tfile, "Bf", &accountfasttime[i][j]); - } - for(j=0;j<60;j++) - { - funpackf(tfile, "Bb", &accountunlocked[i][j]); - } - int temp; - funpackf(tfile, "Bi", &temp); - if(temp>0) - { - for(j=0;j