From: Heli Hyvättinen Date: Tue, 6 Sep 2011 15:14:22 +0000 (+0300) Subject: The levels are now stored in the Levelset class X-Git-Tag: v0.4.0_Maemo~21 X-Git-Url: http://vcs.maemo.org/git/?p=ghostsoverboard;a=commitdiff_plain;h=8f4ed618bdb7482114ae1c1995144213fa768074 The levels are now stored in the Levelset class Works as before. --- diff --git a/seascene.cpp b/seascene.cpp index b877415..63b22a0 100644 --- a/seascene.cpp +++ b/seascene.cpp @@ -61,16 +61,20 @@ SeaScene::SeaScene(QObject *parent) : //Setup the level list + QList levelList; Level level1(5,10); - levelList_.append(level1); + levelList.append(level1); Level level2(5,10,2,50); - levelList_.append(level2); + levelList.append(level2); Level level3(5,15,2,50); - levelList_.append(level3); + levelList.append(level3); Level level4(5,15,4,50); - levelList_.append(level4); + levelList.append(level4); Level level5(5,15,5,100); - levelList_.append(level5); + levelList.append(level5); + + Levelset set ("Original",levelList); + levelset_ = set; currentLevel_ = 0; @@ -596,7 +600,7 @@ void SeaScene::about() void SeaScene::restartLevel() { - setupMap(levelList_.value(currentLevel_)); //value() returns default constructor Level if index is invalid, so no risk of crash + setupMap(levelset_.getLevel(currentLevel_)); //getLevel() returns default constructor Level if index is invalid, so no risk of crash vibrationActivate(pVibrateAction_->isChecked()); //Vibration effects are lost without this // qDebug() << pVibrateAction_->isChecked(); autopauseTimer.start(); //reset counting towards autopause @@ -609,11 +613,11 @@ void SeaScene::nextLevel() currentLevel_++; - if (levelList_.empty()) + if (!levelset_.isValid()) setupMap(Level()); - if ( currentLevel_ < levelList_.size() ) + if ( currentLevel_ < levelset_.numberOfLevels() ) { restartLevel(); } diff --git a/seascene.h b/seascene.h index 99259fc..e246575 100644 --- a/seascene.h +++ b/seascene.h @@ -28,6 +28,7 @@ #include #include "screenlitkeeper.h" #include "level.h" +#include "levelset.h" #include #include #include @@ -140,7 +141,8 @@ protected: QGraphicsTextItem * pVictoryCongratulationsItem_; QGraphicsTextItem * pAboutBoxItem_; - QList levelList_; + + Levelset levelset_; int currentLevel_;