diff --git a/source/code/BlockGame.cpp b/source/code/BlockGame.cpp index 9ebf8a2..49291a1 100644 --- a/source/code/BlockGame.cpp +++ b/source/code/BlockGame.cpp @@ -1293,7 +1293,6 @@ void BlockGame::FindTowerHeight() { /////////////////////////////////////////////////////////////////////////// //First the helpet functions: int BlockGame::nrOfType(int line, int type) { - // cout << "Start_ nrOfType" << "\n"; int counter = 0; for (int i=0; i<6; i++) if (board[i][line]==type) { @@ -1305,7 +1304,6 @@ int BlockGame::nrOfType(int line, int type) { //See if a combo can be made in this line int BlockGame::horiInLine(int line) { - //cout << "Start_ hori in line" << "\n"; int nrOfType[7] = {0, 0, 0, 0, 0, 0, 0}; int max = 0; for (int i=0; i<6; i++) { @@ -1324,7 +1322,6 @@ int BlockGame::horiInLine(int line) { } bool BlockGame::horiClearPossible() { - //cout << "Start_ horiclear possible" << "\n"; int i=13; bool solutionFound = false; do { @@ -1351,7 +1348,6 @@ bool BlockGame::lineHasGarbage(int line) { //Types 0..6 in line int BlockGame::nrOfRealTypes(int line) { - //cout << "Start_ nrOfReal" << "\n"; int counter = 0; for (int i=0; i<6; i++) { if ((board[i][line]>-1)&&(board[i][line]<7)) { @@ -1363,7 +1359,6 @@ int BlockGame::nrOfRealTypes(int line) { //See if there is a tower bool BlockGame::ThereIsATower() { - //cout << "Start_ there is a tower" << "\n"; bool bThereIsATower = false; //Unless proven otherwise! bool topReached = false; //If we have reached the top int lineNumber = 0; @@ -1392,8 +1387,6 @@ bool BlockGame::ThereIsATower() { } } while ((!bThereIsATower)&&(!topReached)); - //if(bThereIsATower) - //cout << "There is actually a tower" << "\n"; return bThereIsATower; } @@ -1440,7 +1433,6 @@ int BlockGame::closestTo(int line, int place) { //The AI will remove a tower void BlockGame::AI_ClearTower() { - // cout << "AI: ClearTower, line: " << AIlineToClear << "\n"; int place = (int)firstInLine(AIlineToClear-1, -1); //Find an empty field to frop a brick into int xplace = closestTo(AIlineToClear, place); //Find the brick to drop in it if (cursory+12) { @@ -1500,7 +1491,6 @@ void BlockGame::AI_ClearHori() { } int xplace = 0; if (leftleft"; int count=0; for (int i=0; (i<4)&&(count<1); i++) { if ((board[i][lowestLine]==AIcolorToClear)&&((i==0)||(board[i+1][lowestLine]!=AIcolorToClear))) { @@ -1510,7 +1500,6 @@ void BlockGame::AI_ClearHori() { } } else { - // cout << ", left>=right"; int count=0; for (int i=3; (i<=5)&&(count<1); i++) { if ((board[i][lowestLine]==AIcolorToClear)&&(board[i-1][lowestLine]!=AIcolorToClear)) { @@ -1519,7 +1508,6 @@ void BlockGame::AI_ClearHori() { } } } - //cout << ", xplace: " << xplace; if (cursorx1000000)||(board[placeToCenter][AIlineToClear+1]>1000000)||(board[placeToCenter][AIlineToClear+2]>1000000))&&(unlimitedLoop<10)) { unlimitedLoop++; placeToCenter++; @@ -1600,9 +1585,7 @@ void BlockGame::AI_ClearVertical() { AIstatus = 0; return; } - //cout << ", ptc: " << placeToCenter << ", line: " << AIlineToClear << ", cy: " << cursory; if (cursory+1>AIlineToClear+2) { - // cout << ", cursory>line+2"; MoveCursor('S'); } if (cursory+1 void serialize( Archive & ar ) { - ar( CEREAL_NVP(ticks), CEREAL_NVP(timeTrial), CEREAL_NVP(stageClear), CEREAL_NVP(puzzleMode), CEREAL_NVP(singlePuzzle), - CEREAL_NVP(level), CEREAL_NVP(AI), CEREAL_NVP(recordStats), CEREAL_NVP(vsMode), CEREAL_NVP(vsAI), + ar( CEREAL_NVP(ticks), CEREAL_NVP(timeTrial), CEREAL_NVP(stageClear), CEREAL_NVP(puzzleMode), CEREAL_NVP(singlePuzzle), + CEREAL_NVP(level), CEREAL_NVP(AI), CEREAL_NVP(recordStats), CEREAL_NVP(vsMode), CEREAL_NVP(vsAI), CEREAL_NVP(startBlocks), CEREAL_NVP(handicap), CEREAL_NVP(gameSpeed) ); } }; @@ -159,11 +159,10 @@ private: int Level = 0; //Only used in stageClear and puzzle (not implemented) BlockGameInfo replayInfo; - + int rand2(); int firstUnusedChain(); -//public: protected: int lastCounter = 0; std::string strHolder; @@ -200,7 +199,7 @@ protected: bool vsAI = false; //Set to true for single player vs int handicap = 0; - + std::vector garbageSendQueue; int AIlineToClear = 0; @@ -218,7 +217,7 @@ public: virtual ~BlockGame() = default; int getAIlevel() const; - + virtual void AddText(int, int, unsigned int, int) const {} virtual void AddBall(int, int, bool, int) const {} virtual void AddExplosion(int, int) const {} @@ -228,7 +227,7 @@ public: virtual void LongChainDoneEvent() const {} virtual void TimeTrialEndEvent() const {} virtual void EndlessHighscoreEvent() const {} - + void NewGame(const BlockGameStartInfo &s); void DoAction (const BlockGameAction& action); /** @@ -238,7 +237,7 @@ public: * @param poppedData */ void PopSendGarbage(std::vector& poppedData); - + int GetScore() const; int GetHandicap() const; bool isGameOver() const; @@ -308,7 +307,7 @@ private: bool CreateGarbage(int wide, int height); //Creates garbage using a given wide and height bool CreateGreyGarbage(); - void MouseDown(int x, int y); //Send then the mouse is pressed + void MouseDown(int x, int y); //Send then the mouse is pressed void MouseMove(int x); //Send then the mouse moves void MouseUp(); //Send then the mouse goes up void MoveCursorTo(int x, int y); diff --git a/source/code/MenuSystem.cpp b/source/code/MenuSystem.cpp index faa623d..b895675 100644 --- a/source/code/MenuSystem.cpp +++ b/source/code/MenuSystem.cpp @@ -113,7 +113,6 @@ static void drawToScreen(const Button& b) { standardButton.getLabel(b.label)->Draw(globalData.screen, b.x+standardButton.xsize/2,b.y+standardButton.ysize/2, sago::SagoTextField::Alignment::center, sago::SagoTextField::VerticalAlignment::center); - //standardButton.thefont->drawCenterAlsoHeight(globalData.screen, b.x+standardButton.xsize/2,b.y+standardButton.ysize/2, b.label); } diff --git a/source/code/gamecontroller.cpp b/source/code/gamecontroller.cpp index bbb4029..bb1686c 100644 --- a/source/code/gamecontroller.cpp +++ b/source/code/gamecontroller.cpp @@ -75,7 +75,6 @@ static int GetNextPlayerByGui(const SDL_JoystickGUID& guid) { Config::getInstance()->setDefault(configName, "1"); int player = Config::getInstance()->getInt(configName) + gamecontrollers_assigned[guidAsHex]; gamecontrollers_assigned[guidAsHex]++; //Next controller with same guid should be assigned to different player. - //std::cout << "Guid: " << guidAsHex << "\n"; if (player%2==0) { return 2; //Even number means player 2 @@ -269,4 +268,4 @@ bool isPlayerPushEvent(int playerNumber, const SDL_Event& event) { } } return false; -} \ No newline at end of file +} diff --git a/source/code/gamecontroller.h b/source/code/gamecontroller.h index 0cff6b6..70c5e56 100644 --- a/source/code/gamecontroller.h +++ b/source/code/gamecontroller.h @@ -21,6 +21,9 @@ http://www.blockattack.net =========================================================================== */ +#ifndef GAMECONTROLLER_H +#define GAMECONTROLLER_HPP + #include "SDL.h" #include #include @@ -42,7 +45,7 @@ const std::vector& GetSupportedControllerNames(); * Checks that the given event is in the dead zone. * If it is in the dead zone. Then the dead zone variable for that axis will be set to true; * Otherwise nothing is done - * @param event An SDL + * @param event An SDL */ void checkDeadZone(const SDL_Event& event); @@ -55,9 +58,11 @@ void checkDeadZone(const SDL_Event& event); bool getDeadZone(SDL_JoystickID id, int axis); /** - * Sets dead zone status on a given axis on a given gamepad + * Sets dead zone status on a given axis on a given gamepad * @param id The gamepad * @param axis The axis on the gamepad * @param value Value to set. Should normally be false as true will be set by checkDeadZone */ -void setDeadZone(SDL_JoystickID id, int axis, bool value); \ No newline at end of file +void setDeadZone(SDL_JoystickID id, int axis, bool value); + +#endif //GAMECONTROLLER diff --git a/source/code/main.cpp b/source/code/main.cpp index 50b7d71..1a9996d 100644 --- a/source/code/main.cpp +++ b/source/code/main.cpp @@ -66,7 +66,7 @@ http://www.blockattack.net #include "highscore.h" //Stores highscores #include "ReadKeyboard.h" //Reads text from keyboard -#include "stats.h" //Saves general stats +#include "stats.h" //Saves general stats #include "replayhandler.hpp" #include "common.h" @@ -722,7 +722,6 @@ static int StartSinglePlayerPuzzle() { a.action = BlockGameAction::Action::SET_GAME_OVER; a.tick = startInfo.ticks; player2->DoAction(a); - //vsMode = true; player1->name = globalData.player1name; player2->name = globalData.player2name; return 0; @@ -778,7 +777,6 @@ static void StartTwoPlayerVs() { startInfo2.handicap = player2handicap; player1->NewGame(startInfo); player2->NewGame(startInfo2); - //vsMode = true; twoPlayers = true; player1->name = globalData.player1name; player2->name = globalData.player2name; diff --git a/source/code/stats.cpp b/source/code/stats.cpp index 4570e80..5f6a47b 100644 --- a/source/code/stats.cpp +++ b/source/code/stats.cpp @@ -58,7 +58,7 @@ void Stats::load() { } Stats* Stats::getInstance() { - if (Stats::instance==nullptr) { + if (!Stats::instance) { Stats::instance = new Stats(); }