[atlantik-cvs] CVS: kdegames/atlantik/client atlantik.cpp, 1.166, 1.167 atlantik.h,1.67,1.68 main.h,1.48,1.49
[email protected] Sun, 27 Jun 2004 18:04:46 +0200
| Newsgroups | gmane.comp.kde.devel.atlantik |
|---|---|
| Message-ID | <[email protected]> |
Update of /home/kde/kdegames/atlantik/client
In directory office:/tmp/cvs-serv539/client
Modified Files:
atlantik.cpp atlantik.h main.h
Log Message:
Backport from development tree:
Warn on intended close/quit, if user confirms, properly withdraw from game
first. Avoids that other players have to wait three minutes for the
reconnection timeout to expire.
Index: atlantik.cpp
===================================================================
RCS file: /home/kde/kdegames/atlantik/client/atlantik.cpp,v
retrieving revision 1.166
retrieving revision 1.167
diff -u -d -r1.166 -r1.167
--- atlantik.cpp 29 May 2004 12:08:58 -0000 1.166
+++ atlantik.cpp 27 Jun 2004 16:04:43 -0000 1.167
@@ -28,6 +28,7 @@
#include <kcmdlineargs.h>
#include <kconfig.h>
#include <klocale.h>
+#include <kmessagebox.h>
#include <knotifyclient.h>
#include <knotifydialog.h>
#include <kstatusbar.h>
@@ -803,3 +804,22 @@
return 0;
}
+
+void Atlantik::closeEvent(QCloseEvent *e)
+{
+ Game *gameSelf = m_atlanticCore->gameSelf();
+ Player *playerSelf = m_atlanticCore->playerSelf();
+
+ int result = KMessageBox::Yes;
+ if ( gameSelf && !playerSelf->isBankrupt() )
+ result = KMessageBox::warningYesNo( this, i18n("You are currently part of an active game. Are you sure you want to close Atlantik? If you do, you forfeit the game."), i18n("Close and Forfeit?") );
+
+ if ( result == KMessageBox::Yes )
+ {
+ if ( m_atlantikNetwork )
+ m_atlantikNetwork->leaveGame();
+
+ saveMainWindowSettings(kapp->config(), "AtlantikMainWindow");
+ KMainWindow::closeEvent(e);
+ }
+}
Index: atlantik.h
===================================================================
RCS file: /home/kde/kdegames/atlantik/client/atlantik.h,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -d -r1.67 -r1.68
--- atlantik.h 23 Jun 2004 12:08:03 -0000 1.67
+++ atlantik.h 27 Jun 2004 16:04:43 -0000 1.68
@@ -223,6 +223,9 @@
void jailPay();
void jailRoll();
+protected:
+ void closeEvent(QCloseEvent *);
+
private:
void initEventLog();
void initNetworkObject();
Index: main.h
===================================================================
RCS file: /home/kde/kdegames/atlantik/client/main.h,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- main.h 22 Jun 2004 18:42:17 -0000 1.48
+++ main.h 27 Jun 2004 16:04:43 -0000 1.49
@@ -18,7 +18,7 @@
#define ATLANTIK_MAIN_H
#define ATLANTIK_VERSION 070
-#define ATLANTIK_VERSION_STRING "0.7.0 (CVS >= 20040622)"
+#define ATLANTIK_VERSION_STRING "0.7.0 (CVS >= 20040627)"
#define ATLANTIK_VERSION_MAJOR 0
#define ATLANTIK_VERSION_MINOR 7