diff --git a/source/code/BlockGame.cpp b/source/code/BlockGame.cpp index 6b6efae..ef2b239 100644 --- a/source/code/BlockGame.cpp +++ b/source/code/BlockGame.cpp @@ -518,32 +518,32 @@ void BlockGame::playNetwork(int tx, int ty,unsigned int ticks) void BlockGame::setPlayerWon() { ActionPerformed(ACTION_WIN,""); - if (!bGameOver) + if (!bGameOver || !hasWonTheGame) { gameEndedAfter = ticks-gameStartedAt; //We game ends now! if(!AI_Enabled && !bReplaying) { TimeHandler::addTime("playTime",TimeHandler::ms2ct(gameEndedAfter)); } - } - bGameOver = true; - hasWonTheGame = true; - showGame = false; - if (SoundEnabled)Mix_PlayChannel(1, applause, 0); - if(!AI_Enabled && !bReplaying) - { - Stats::getInstance()->addOne("totalWins"); - if(garbageTarget->AI_Enabled && !(garbageTarget->bReplaying)) + bGameOver = true; + if (SoundEnabled)Mix_PlayChannel(1, applause, 0); + if(!AI_Enabled && !bReplaying) { - //We have defeated an AI - Stats::getInstance()->addOne("defeatedAI"+itoa(garbageTarget->getAIlevel())); + Stats::getInstance()->addOne("totalWins"); + if(garbageTarget->AI_Enabled && !(garbageTarget->bReplaying)) + { + //We have defeated an AI + Stats::getInstance()->addOne("defeatedAI"+itoa(garbageTarget->getAIlevel())); + } + } + if(AI_Enabled && !(garbageTarget->AI_Enabled) && garbageTarget->bReplaying==false) + { + //The AI have defeated a human player + Stats::getInstance()->addOne("defeatedByAI"+itoa(getAIlevel())); } } - if(AI_Enabled && !(garbageTarget->AI_Enabled) && garbageTarget->bReplaying==false) - { - //The AI have defeated a human player - Stats::getInstance()->addOne("defeatedByAI"+itoa(getAIlevel())); - } + hasWonTheGame = true; + showGame = false; } //void SetGameOver(); diff --git a/source/code/main.cpp b/source/code/main.cpp index b2eae60..7b0eb4b 100644 --- a/source/code/main.cpp +++ b/source/code/main.cpp @@ -536,7 +536,7 @@ static int InitImages() menuMarked = IMG_Load3("gfx/menu/marked.png"); menuUnmarked = IMG_Load3("gfx/menu/unmarked.png"); } - catch (exception e) + catch (exception &e) { cerr << e.what() << endl; exit(1); @@ -832,12 +832,12 @@ static int LoadPuzzleStages() { //if(puzzleLoaded) // return 1; - if (!PHYSFS_exists(("puzzles/"+puzzleName).c_str())) + if (!PHYSFS_exists(((string)("puzzles/"+puzzleName)).c_str())) { cerr << "Warning: File not in blockattack.data: " << ("puzzles/"+puzzleName) << endl; return -1; //file doesn't exist } - PhysFS::ifstream inFile(("puzzles/"+puzzleName).c_str()); + PhysFS::ifstream inFile(((string)("puzzles/"+puzzleName)).c_str()); inFile >> nrOfPuzzles; if (nrOfPuzzles>maxNrOfPuzzleStages) @@ -1184,7 +1184,7 @@ public: return y; } - char* getText() + const char* getText() { return textt; } @@ -1879,7 +1879,7 @@ void DrawStats() for(int i=0; i<7; i++) { y += y_spacing; - NFont_Write(screen, x_offset,y,("AI "+itoa(i+1)).c_str()); + NFont_Write(screen, x_offset,y,string("AI "+itoa(i+1)).c_str()); numberAsString = itoa(Stats::getInstance()->getNumberOf("defeatedAI"+itoa(i))); string numberAsString2 = itoa(Stats::getInstance()->getNumberOf("defeatedByAI"+itoa(i))); string toPrint = numberAsString + "/" + numberAsString2; diff --git a/source/code/menudef.cpp b/source/code/menudef.cpp index 7ebcc3c..c1214ec 100644 --- a/source/code/menudef.cpp +++ b/source/code/menudef.cpp @@ -290,13 +290,13 @@ static void SinglePlayerVsMenu(Button *b) d5.setPopOnRun(true); d6.setPopOnRun(true); d7.setPopOnRun(true); - d1.iGeneric1 = 1; - d2.iGeneric1 = 2; - d3.iGeneric1 = 3; - d4.iGeneric1 = 4; - d5.iGeneric1 = 5; - d6.iGeneric1 = 6; - d7.iGeneric1 = 7; + d1.iGeneric1 = 0; + d2.iGeneric1 = 1; + d3.iGeneric1 = 2; + d4.iGeneric1 = 3; + d5.iGeneric1 = 4; + d6.iGeneric1 = 5; + d7.iGeneric1 = 6; d1.setLabel(_("Very easy")); d2.setLabel(_("Easy")); d3.setLabel(_("Below normal")); diff --git a/source/code/physfs_stream.hpp b/source/code/physfs_stream.hpp index 0513a34..d8a5b58 100644 --- a/source/code/physfs_stream.hpp +++ b/source/code/physfs_stream.hpp @@ -193,7 +193,7 @@ protected: } char_type* xend = (static_cast (objectsRead) == BUF_SIZE) ? &*_buf.end() : &_buf[objectsRead]; - setg(&*_buf.begin(), &*_buf.begin(), xend); + this->setg(&*_buf.begin(), &*_buf.begin(), xend); return traits_type::to_int_type(_buf.front()); } @@ -209,7 +209,7 @@ protected: } // the seek invalidated the buffer - setg(&*_buf.begin(), &*_buf.begin(), &*_buf.begin()); + this->setg(&*_buf.begin(), &*_buf.begin(), &*_buf.begin()); return pos; } @@ -274,7 +274,7 @@ protected: } char_type* xend = (static_cast (res) == BUF_SIZE) ? &*_buf.end() : &_buf[res]; - setp(&*_buf.begin(), xend); + this->setp(&*_buf.begin(), xend); return 0; }