-rw-r--r-- | noncore/games/bounce/opie-bounce.control | 2 | ||||
-rw-r--r-- | noncore/games/buzzword/opie-buzzword.control | 2 | ||||
-rw-r--r-- | noncore/games/kbill/opie-kbill.control | 2 | ||||
-rw-r--r-- | noncore/games/kcheckers/opie-kcheckers.control | 2 | ||||
-rw-r--r-- | noncore/games/kpacman/opie-kpacman.control | 2 | ||||
-rw-r--r-- | noncore/games/tetrix/ohighscoredlg.cpp | 81 | ||||
-rw-r--r-- | noncore/games/tetrix/ohighscoredlg.h | 13 | ||||
-rw-r--r-- | noncore/games/tetrix/tetrix.pro | 2 |
8 files changed, 56 insertions, 50 deletions
diff --git a/noncore/games/bounce/opie-bounce.control b/noncore/games/bounce/opie-bounce.control index dfd1bf0..0513958 100644 --- a/noncore/games/bounce/opie-bounce.control +++ b/noncore/games/bounce/opie-bounce.control @@ -1,11 +1,11 @@ Package: opie-bounce Files: plugins/application/libbounce.so* bin/bounce apps/Games/bounce.desktop pics/bounce/*.png -Version: 0.6-$SUB_VERSION +Version: $QPE_VERSION$EXTRAVERSION Depends: task-opie-minimal, libopiecore2 Priority: optional Section: opie/games Maintainer: Martin Imobersteg <imm@gmx.ch> Architecture: arm License: GPL Description: bounce A JezzGame like game for Qtopia. diff --git a/noncore/games/buzzword/opie-buzzword.control b/noncore/games/buzzword/opie-buzzword.control index 3316445..f76a2c2 100644 --- a/noncore/games/buzzword/opie-buzzword.control +++ b/noncore/games/buzzword/opie-buzzword.control @@ -1,11 +1,11 @@ Package: opie-buzzword Files: plugins/application/libbuzzword.so* bin/buzzword apps/Games/buzzword.desktop pics/buzzword/buzzword.png share/buzzword/buzzwords -Version: 1.1-$SUB_VERSION +Version: $QPE_VERSION$EXTRAVERSION Depends: task-opie-minimal,libopiecore2 Priority: optional Section: opie/games Maintainer: Martin Imobersteg <imm@gmx.ch> Architecture: arm License: GPL Description: BuzzWord A BuzzWord Bingo for the Opie environment. diff --git a/noncore/games/kbill/opie-kbill.control b/noncore/games/kbill/opie-kbill.control index 3299b93..cf12bca 100644 --- a/noncore/games/kbill/opie-kbill.control +++ b/noncore/games/kbill/opie-kbill.control @@ -1,13 +1,13 @@ Package: opie-kbill Files: bin/kbill apps/Games/kbill.desktop pics/kbill/* Priority: optional Section: opie/games Maintainer: Mark Westcott <mark@houseoffish.org> Architecture: arm -Version: 0.8-$SUB_VERSION +Version: $QPE_VERSION$EXTRAVERSION Depends: task-opie-minimal License: GPL Description: The famous hit Bill game Hit Bill as hard as you can before he infects your network with a wannabe OS. diff --git a/noncore/games/kcheckers/opie-kcheckers.control b/noncore/games/kcheckers/opie-kcheckers.control index 5bd03ae..e7c20d3 100644 --- a/noncore/games/kcheckers/opie-kcheckers.control +++ b/noncore/games/kcheckers/opie-kcheckers.control @@ -1,10 +1,10 @@ Package: opie-kcheckers Files: plugins/application/libkcheckers.so* bin/kcheckers apps/Games/kcheckers.desktop pics/kcheckers Priority: optional Section: opie/games Maintainer: leseb <prudhomme@laposte.net> Architecture: arm -Version: 0.3-$SUB_VERSION +Version: $QPE_VERSION$EXTRAVERSION Depends: task-opie-minimal, libopiecore2 Description: The game of Checkers A game for the Opie environment. diff --git a/noncore/games/kpacman/opie-kpacman.control b/noncore/games/kpacman/opie-kpacman.control index 68487ec..97120aa 100644 --- a/noncore/games/kpacman/opie-kpacman.control +++ b/noncore/games/kpacman/opie-kpacman.control @@ -1,11 +1,11 @@ Package: opie-kpacman Files: plugins/applications/libkpacman.so* bin/kpacman apps/Games/kpacman.desktop pics/kpacman/kpacman.png share/kpacman -Version: 0.3.1-$SUB_VERSION +Version: $QPE_VERSION$EXTRAVERSION Depends: task-opie-minimal Priority: optional Section: opie/games Maintainer: Catalin Climov <catalin@climov.com> Architecture: arm License: GPL Description: Kpacman A Pacman clone for Qtopia. diff --git a/noncore/games/tetrix/ohighscoredlg.cpp b/noncore/games/tetrix/ohighscoredlg.cpp index 8d8079e..66f4917 100644 --- a/noncore/games/tetrix/ohighscoredlg.cpp +++ b/noncore/games/tetrix/ohighscoredlg.cpp @@ -10,140 +10,137 @@ * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * ( at your option ) any later version. * * * **************************************************************************/ #include <qdialog.h> #include <qlayout.h> #include <qpe/qpeapplication.h> #include <qpe/config.h> #include <qstring.h> +#include <qlist.h> #include <qhbox.h> #include <qvbox.h> #include <qlabel.h> #include <qlistview.h> #include <qlineedit.h> #include "ohighscoredlg.h" -OHighscore::OHighscore( int score , int playerLevel ) +OHighscore::OHighscore( int score , int playerLevel ) : playerData() { pLevel = playerLevel; getList(); checkIfItIsANewhighscore( score ); + playerData.setAutoDelete( TRUE ); } OHighscore::~OHighscore() { - std::list<t_playerData*>::iterator deleteIterator = playerData.begin(); - for ( ; deleteIterator != playerData.end() ; deleteIterator++ ) - { - delete ( *deleteIterator ); - } } void OHighscore::getList() { Config cfg ( "tetrix" ); cfg.setGroup( QString::number( 1 ) ); lowest = cfg.readNumEntry( "Points" ); playerData.clear(); int rest = 1; //for the filling up later for ( int i = 1 ; i < 11 ; i++ ) { if ( cfg.hasGroup( QString::number( i ) ) ) { cfg.setGroup( QString::number( i ) ); int temp = cfg.readNumEntry( "Points" ); t_playerData *pPlayerData = new t_playerData; pPlayerData->sName = cfg.readEntry( "Name" ); pPlayerData->points = temp; pPlayerData->level = cfg.readNumEntry( "Level" ); - playerData.push_back( pPlayerData ); + playerData.append( pPlayerData ); if ( (temp < lowest) ) lowest = temp; rest++; } } //now I fill up the rest of the list if ( rest < 11 ) //only go in this loop if there are less than //10 highscoreentries { lowest = 0; for ( ; rest < 11 ; rest++ ) { t_playerData *pPlayerData = new t_playerData; pPlayerData->sName = tr( "empty"); pPlayerData->points = 0; pPlayerData->level = 0; - playerData.push_back( pPlayerData ); + playerData.append( pPlayerData ); } } } void OHighscore::checkIfItIsANewhighscore( int points) { if ( points > lowest ) isNewhighscore = true; else isNewhighscore = false; } void OHighscore::insertData( QString name , int punkte , int playerLevel ) { Config cfg ( "tetrix" ); + t_playerData * Run; + int index = 0; int entryNumber = 1; - std::list<t_playerData*>::iterator insertIterator = playerData.begin(); - while ( insertIterator != playerData.end() ) - { - if ( punkte > ( *insertIterator )->points ) + + for ( Run=playerData.first(); + Run != 0; + index ++, Run=playerData.next() ) { + + if ( punkte > Run->points ) { t_playerData* temp = new t_playerData; temp->sName = name; temp->points = punkte; temp->level = playerLevel; - playerData.insert( insertIterator , temp ); + + playerData.insert( index, temp ); //now we have to delete the last entry - insertIterator = playerData.end(); - insertIterator--; -//X delete *insertIterator; //memleak? - playerData.erase( insertIterator ); + playerData.remove( playerData.count() ); ///////////////////////////////////////// //this block just rewrites the highscore - insertIterator = playerData.begin(); - while ( insertIterator != playerData.end() ) - { + for ( t_playerData * Run2=playerData.first(); + Run2 != 0; + Run2=playerData.next() ) { cfg.setGroup( QString::number( entryNumber ) ); - cfg.writeEntry( "Name" , ( *insertIterator )->sName ); - cfg.writeEntry( "Points" , ( *insertIterator )->points ); - cfg.writeEntry( "Level" , ( *insertIterator )->level ); + cfg.writeEntry( "Name" , Run2->sName ); + cfg.writeEntry( "Points" , Run2->points ); + cfg.writeEntry( "Level" , Run2->level ); entryNumber++; - insertIterator++; } //////////////////////////////////////// return; } - insertIterator++; } } QString OHighscore::getName() { QString name; QDialog *d = new QDialog ( this, 0, true ); d->setCaption( tr( "Enter your name!" )); QLineEdit *ed = new QLineEdit ( d ); ( new QVBoxLayout ( d, 3, 3 ))->addWidget ( ed ); ed->setFocus ( ); @@ -168,32 +165,42 @@ OHighscoreDialog::OHighscoreDialog(OHighscore *highscore, QWidget *parent, const createHighscoreListView(); vbox_layout->addWidget( list ); QPEApplication::showDialog( this ); } void OHighscoreDialog::createHighscoreListView() { int pos = 10; int points_ = 0; int level_ = 0; - - std::list<t_playerData*>::reverse_iterator iListe = hs_->playerData.rbegin(); - - for ( ; iListe != hs_->playerData.rend() ; ++iListe ) - { - QListViewItem *item = new QListViewItem( list ); + QListViewItem * Prev = 0; + + for ( t_playerData * Run = hs_->playerData.first(); + Run != 0; + Run=hs_->playerData.next() ) + { + QListViewItem *item; + + if( Prev ) { + // after previous + item = new QListViewItem( list, Prev ); + Prev = item; + } else { + item = new QListViewItem( list ); + + } item->setText( 0 , QString::number( pos ) ); //number - item->setText( 1 , ( *iListe )->sName ); //name - if ( ( *iListe )->points == -1 ) + item->setText( 1 , Run->sName ); //name + if ( Run->points == -1 ) points_ = 0; - else points_ = ( *iListe )->points; - if ( ( *iListe )->level == -1 ) - level_ = 0; - else level_ = ( *iListe )->level; + else points_ = Run->points; + if ( Run->level == -1 ) + level_ = 0; + else level_ = Run->level; item->setText( 2 , QString::number( points_ ) ); //points item->setText( 3 , QString::number( level_ ) ); //level pos--; } } diff --git a/noncore/games/tetrix/ohighscoredlg.h b/noncore/games/tetrix/ohighscoredlg.h index fdbe623..845e639 100644 --- a/noncore/games/tetrix/ohighscoredlg.h +++ b/noncore/games/tetrix/ohighscoredlg.h @@ -3,30 +3,31 @@ * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * ( at your option ) any later version. * * * **************************************************************************/ class QWidget; class QVBoxLayout; class QListView; #include <qdialog.h> -#include <list> +#include <qlist.h> -using namespace std; - -struct t_playerData +class t_playerData { + +public : + QString sName; int points; int level; }; class OHighscore : public QWidget { Q_OBJECT public: /* *An OHighscore-Object contains all Points, level and playernames sorted in a stl::vector @@ -36,34 +37,32 @@ class OHighscore : public QWidget ~OHighscore(); /* * is true if the player did a new highscore */ bool isNewhighscore; /* * this inserts the new entry at the correct position */ void insertData( QString , int , int ); - list<t_playerData*> playerData; + QList<t_playerData> playerData; /* * As Qt/e does not support QInputDialog I did that code myself */ QString getName(); private: - list<t_playerData*>::iterator iPlayerData; - /* * the lowest score in the highscorelist */ int lowest; /* * the level of the highscore */ int pLevel; /* * get all scores in a vector and give "lowest" a value diff --git a/noncore/games/tetrix/tetrix.pro b/noncore/games/tetrix/tetrix.pro index 580a542..96f452f 100644 --- a/noncore/games/tetrix/tetrix.pro +++ b/noncore/games/tetrix/tetrix.pro @@ -3,20 +3,20 @@ HEADERS = gtetrix.h \ qtetrix.h \ qtetrixb.h \ tpiece.h \ ohighscoredlg.h SOURCES = main.cpp \ gtetrix.cpp \ qtetrix.cpp \ qtetrixb.cpp \ tpiece.cpp \ ohighscoredlg.cpp INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include -LIBS += -lqpe -lopiecore2 -lstdc++ +LIBS += -lqpe -lopiecore2 INTERFACES = TARGET = tetrix include( $(OPIEDIR)/include.pro ) |