[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdenonbeta/kue
From:       Ryan Cumming <ryan () kde ! org>
Date:       2002-12-05 3:16:56
[Download RAW message or body]

CVS commit by cumming: 

Unbreak endGame/gameOver semantics, cleanup, documentation


  M +8 -5      main.cpp   1.6
  M +4 -1      rules.h   1.2


--- kdenonbeta/kue/main.cpp:1.5	Wed Dec  4 12:22:02 2002
@@ -36,8 +36,6 @@
 MainWindow *_MainWindow;
 QVector<KueTeam> _teams;
 
-const int max_framerate = 50;
-
 MainWindow::MainWindow()
 {
 	// We have a statusbar, show it now
@@ -172,13 +170,14 @@
 
 void MainWindow::endGame()
 {
-	if (!_in_game)
-		return;
-
 	delete rulesInstance;
 	delete _GLWidget;
 	delete physicsInstance;
 
+	rulesInstance = 0;
+	_GLWidget = 0;
+	physicsInstance = 0;
+
 	statusBar()->message(QString::null);
 	_in_game = false;
 	_end_action->setEnabled(false);
@@ -186,6 +185,10 @@
 
 void MainWindow::endGame(const QString &reason)
 {
+	// Stop the physics engine
+	physicsInstance->stop();
+
+	// Notify the user
 	KMessageBox::information(this, reason, i18n("Game Over"));
 
 	// We do this delayed, because most modules don't (and can't) call this
--- kdenonbeta/kue/rules.h:1.1.1.1	Sun Mar 10 21:42:36 2002
@@ -7,6 +7,7 @@
 #include "point.h"
 #include "rules.h"
 
+// Temple for rules engine plugins
 class KueRulesEngine : public QObject {
   Q_OBJECT
   public:
@@ -16,7 +17,9 @@
 	virtual void start() = 0;
 
   signals:
-	void gameOver();
+	// Emitting gameOver notifies the user of the result, stops the physics
+	// engine, and schedules us for deletion
+	void gameOver(const QString &result);
 	void showMessage(const QString &text);
 
   protected slots:

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic