commit b651f87a
Some uninitialized variables and wrong logic
Changed files
| M | source/code/BlockGame.cpp before |
| M | source/code/main.cpp before |
diff --git a/source/code/BlockGame.cpp b/source/code/BlockGame.cpp
index f11fbef..ce52d84 100644
--- a/source/code/BlockGame.cpp
+++ b/source/code/BlockGame.cpp
@@ -613,7 +613,7 @@ bool BlockGame::CreateGarbage(int wide, int height) {
height = 12;
}
int startPosition = 12;
- while ((!(LineEmpty(startPosition))) || (startPosition == 29)) {
+ while (!LineEmpty(startPosition) && startPosition < 29) {
startPosition++;
}
if (startPosition == 29) {
diff --git a/source/code/main.cpp b/source/code/main.cpp
index 12a0896..125e790 100644
--- a/source/code/main.cpp
+++ b/source/code/main.cpp
@@ -377,14 +377,14 @@ static BallManager theBallManager;
//a explosions, non moving
class AnExplosion {
private:
- int x;
- int y;
- Uint8 frameNumber;
+ int x = 0;
+ int y = 0;
+ Uint8 frameNumber = 0;
#define frameLength 80
//How long an image in an animation should be showed
#define maxFrame 4
//How many images there are in the animation
- unsigned long int placeTime; //Then the explosion occored
+ unsigned long int placeTime = 0; //Then the explosion occored
public:
AnExplosion() {