From: Côme BERNIGAUD Date: Wed, 11 May 2011 11:55:41 +0000 (+0200) Subject: clean ups, and now campaignProgess is well initialized in accounts X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=38a0b81007611ee5f49b674ea5605fe79dac7e1e;p=lugaru.git clean ups, and now campaignProgess is well initialized in accounts --- diff --git a/Source/Account.cpp b/Source/Account.cpp index 45e1300..beb5f46 100644 --- a/Source/Account.cpp +++ b/Source/Account.cpp @@ -32,7 +32,7 @@ extern bool debugmode; vector Account::accounts = vector(); -Account::Account(string n) { +Account::Account(string n) : campaignProgress() { name = string(n); difficulty = 0; progress = 0; @@ -41,7 +41,15 @@ Account::Account(string n) { memset(fasttime, 0, sizeof(fasttime)); memset(unlocked, 0, sizeof(unlocked)); - currentCampaign = "main"; + setCurrentCampaign("main"); +} + +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) { @@ -102,7 +110,6 @@ Account* Account::loadFile(string filename) { FILE *tfile; int numaccounts; int accountactive; - int j; tfile=fopen(ConvertFileName(filename.c_str()), "rb" ); @@ -126,7 +133,7 @@ Account* Account::loadFile(string filename) { int t; char c; funpackf(tfile, "Bi", &t); - for(j=0;jcampaignProgress[campaignName].highscore)); int campaignchoicesmade,campaignchoice; funpackf(tfile, "Bi", &campaignchoicesmade); - for(j=0;j= 10) // what is that for? @@ -150,19 +157,19 @@ Account* Account::loadFile(string filename) { } funpackf(tfile, "Bf", &(acc->points)); - for(j=0;j<50;j++) + for(int i=0;i<50;i++) { - funpackf(tfile, "Bf", &(acc->highscore[j])); - funpackf(tfile, "Bf", &(acc->fasttime[j])); + funpackf(tfile, "Bf", &(acc->highscore[i])); + funpackf(tfile, "Bf", &(acc->fasttime[i])); } - for(j=0;j<60;j++) + for(int i=0;i<60;i++) { - funpackf(tfile, "Bb", &(acc->unlocked[j])); + funpackf(tfile, "Bb", &(acc->unlocked[i])); } int temp; char ctemp; funpackf(tfile, "Bi", &temp); - for(j=0;jname.append(1,ctemp); diff --git a/Source/Account.h b/Source/Account.h index acd2850..388c064 100644 --- a/Source/Account.h +++ b/Source/Account.h @@ -73,6 +73,7 @@ class Account { float getHighScore(int i) { return highscore[i]; }; float getFastTime(int i) { return fasttime[i]; }; int getProgress() { return progress; }; + void setCurrentCampaign(std::string name); static int getNbAccounts() { return accounts.size(); }; private: diff --git a/Source/Frustum.cpp b/Source/Frustum.cpp index 9425dde..f8fb2f5 100644 --- a/Source/Frustum.cpp +++ b/Source/Frustum.cpp @@ -30,7 +30,6 @@ void FRUSTUM:: static float projmatrix[16]; static float mvmatrix[16]; static float clip[16]; - static float t; glGetFloatv(GL_PROJECTION_MATRIX, projmatrix); glGetFloatv(GL_MODELVIEW_MATRIX, mvmatrix); diff --git a/Source/GameDraw.cpp b/Source/GameDraw.cpp index 70b6716..ad542f1 100644 --- a/Source/GameDraw.cpp +++ b/Source/GameDraw.cpp @@ -2674,17 +2674,16 @@ void Game::DrawMenu() if(mainmenu==1||mainmenu==2) for(i=1;i<4;i++){ - if((mousecoordh/screenwidth*640)>startx[i]&&(mousecoordh/screenwidth*640)starty[i]&&480-(mousecoordv/screenheight*480)startx[i]&&(mousecoordh/screenwidth*640)starty[i]&&480-(mousecoordv/screenheight*480)startx[i]&&(mousecoordh/screenwidth*640)starty[i]&&480-(mousecoordv/screenheight*480)startx[i]&&(mousecoordh/screenwidth*640)starty[i]&&480-(mousecoordv/screenheight*480) 0.999999) { - r12 = 2 * (q.v.x*q.v.y - q.n*q.v.z); - r13 = 2 * (q.v.x*q.v.z + q.n*q.v.y); + double r12 = 2 * (q.v.x*q.v.y - q.n*q.v.z); + double r13 = 2 * (q.v.x*q.v.z + q.n*q.v.y); u.x = RadiansToDegrees(0.0f); //roll u.y = RadiansToDegrees((float) (-(pi/2) * r31/tmp)); // pitch