summaryrefslogtreecommitdiff
path: root/noncore/games/parashoot/helicopter.cpp
authorzecke <zecke>2004-02-06 14:32:10 (UTC)
committer zecke <zecke>2004-02-06 14:32:10 (UTC)
commitb033733924e5d3454bb0a810c6a70d4ff0531d2b (patch) (side-by-side diff)
treecafe130296468840db062af4a3335572804ee1f3 /noncore/games/parashoot/helicopter.cpp
parentf60cbb888e72b3eaf49af6f72fa183e6d44ae389 (diff)
downloadopie-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/helicopter.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/parashoot/helicopter.cpp28
1 files changed, 17 insertions, 11 deletions
diff --git a/noncore/games/parashoot/helicopter.cpp b/noncore/games/parashoot/helicopter.cpp
index 0923124..036b21e 100644
--- a/noncore/games/parashoot/helicopter.cpp
+++ b/noncore/games/parashoot/helicopter.cpp
@@ -1,5 +1,5 @@
/**********************************************************************
-** Copyright (C) 2000 Trolltech AS. All rights reserved.
+** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
**
-** This file is part of Qtopia Environment.
+** This file is part of the Qtopia Environment.
**
@@ -24,3 +24,3 @@
-#include <qpe/resource.h>
+#include <qtopia/resource.h>
@@ -39,3 +39,4 @@ Helicopter::Helicopter(QCanvas* canvas) :
h0.replace(QRegExp("0001"),"%1");
- helicopterarray->readPixmaps(h0,3 );
+ helicopterarray->readPixmaps(h0,4 );
+
setSequence(helicopterarray);
@@ -59,5 +60,14 @@ void Helicopter::advance(int phase)
if (phase == 0) {
- setFrame(fr%3);
- fr++;
- checkCollision();
+ if (frame() == 3) {
+ delete this;
+ return;
+ }
+
+ if (hits >= 2) {
+ setFrame(3);
+ } else {
+ setFrame(fr%3);
+ fr++;
+ checkCollision();
+ }
}
@@ -85,6 +95,2 @@ void Helicopter::done()
hits++;
- if (hits >= 2) {
- setAnimated(false);
- delete this;
- }
}