author | zecke <zecke> | 2004-02-06 14:32:10 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-02-06 14:32:10 (UTC) |
commit | b033733924e5d3454bb0a810c6a70d4ff0531d2b (patch) (unidiff) | |
tree | cafe130296468840db062af4a3335572804ee1f3 /noncore/games/parashoot/man.cpp | |
parent | f60cbb888e72b3eaf49af6f72fa183e6d44ae389 (diff) | |
download | opie-b033733924e5d3454bb0a810c6a70d4ff0531d2b.zip opie-b033733924e5d3454bb0a810c6a70d4ff0531d2b.tar.gz opie-b033733924e5d3454bb0a810c6a70d4ff0531d2b.tar.bz2 |
Funny how much bugs one can introduce when importing Qtopia stuff.
Fixed a couple of possible sigsegv, uninitialized variables
Diffstat (limited to 'noncore/games/parashoot/man.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/games/parashoot/man.cpp | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/noncore/games/parashoot/man.cpp b/noncore/games/parashoot/man.cpp index 8435572..94807c2 100644 --- a/noncore/games/parashoot/man.cpp +++ b/noncore/games/parashoot/man.cpp | |||
@@ -1,5 +1,5 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
@@ -20,3 +20,3 @@ | |||
20 | 20 | ||
21 | #include "codes.h" | 21 | #include "codes.h" |
22 | #include "man.h" | 22 | #include "man.h" |
@@ -24,3 +24,3 @@ | |||
24 | 24 | ||
25 | #include <qpe/resource.h> | 25 | #include <qtopia/resource.h> |
26 | 26 | ||
@@ -32,3 +32,3 @@ Man::Man(QCanvas* canvas) : | |||
32 | QCanvasSprite(0, canvas), | 32 | QCanvasSprite(0, canvas), |
33 | splat("lose") | 33 | splat("lose") // No tr |
34 | { | 34 | { |
@@ -37,3 +37,3 @@ Man::Man(QCanvas* canvas) : | |||
37 | m0.replace(QRegExp("0001"),"%1"); | 37 | m0.replace(QRegExp("0001"),"%1"); |
38 | manarray->readPixmaps(m0, 7); | 38 | manarray->readPixmaps(m0, 7); |
39 | setSequence(manarray); | 39 | setSequence(manarray); |
@@ -47,3 +47,3 @@ Man::Man(QCanvas* canvas, int x, int y) : | |||
47 | QCanvasSprite(0, canvas), | 47 | QCanvasSprite(0, canvas), |
48 | splat("bang") | 48 | splat("bang") // No tr |
49 | { | 49 | { |
@@ -64,3 +64,3 @@ Man::Man(QCanvas* canvas, int x, int y) : | |||
64 | srand(midnight.secsTo(QTime::currentTime()) ); | 64 | srand(midnight.secsTo(QTime::currentTime()) ); |
65 | } | 65 | } |
66 | int yfallspeed = 0; | 66 | int yfallspeed = 0; |
@@ -94,5 +94,12 @@ void Man::advance(int phase) | |||
94 | setVelocity(-2, 0); | 94 | setVelocity(-2, 0); |
95 | } | 95 | } else if (xVelocity() == -2) { |
96 | // | ||
97 | // There's been a resize event while this Man has | ||
98 | // been on the ground. Move the man back to the | ||
99 | // new ground location. This is not neat. | ||
100 | // | ||
101 | move(x(), canvas()->height()-26); | ||
102 | } | ||
96 | } | 103 | } |
97 | } | 104 | } |
98 | 105 | ||
@@ -112,3 +119,3 @@ void Man::setInitialCoords() | |||
112 | void Man::checkCollision() | 119 | void Man::checkCollision() |
113 | { | 120 | { |
114 | if ( (x() < 23) && (y() == canvas()->height()-26)) { | 121 | if ( (x() < 23) && (y() == canvas()->height()-26)) { |
@@ -125,2 +132,12 @@ void Man::checkCollision() | |||
125 | } | 132 | } |
133 | |||
134 | // | ||
135 | // resize events may cause Man objects to appear | ||
136 | // outside the screen. Get rid of them if this | ||
137 | // is the case. | ||
138 | // | ||
139 | if ((x() < 0) || (x() > canvas()->width())) { | ||
140 | delete this; | ||
141 | return; | ||
142 | } | ||
126 | } | 143 | } |