summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
authorRogier Polak <rogier.l.a.polak@gmail.com>2007-02-23 19:18:28 +0000
committerRogier Polak <rogier.l.a.polak@gmail.com>2007-02-23 19:18:28 +0000
commit775404c84c3250225d43f10c4a5363e997618cb2 (patch)
tree38393287d1554d8e19471f24bc65525c79efeccb /src/game.cpp
parentfee8461a594770f8ef2bd826868a4ae81270a666 (diff)
downloadmana-client-775404c84c3250225d43f10c4a5363e997618cb2.tar.gz
mana-client-775404c84c3250225d43f10c4a5363e997618cb2.tar.bz2
mana-client-775404c84c3250225d43f10c4a5363e997618cb2.tar.xz
mana-client-775404c84c3250225d43f10c4a5363e997618cb2.zip
Added unregistering, logout_then_exit, switch_character and switch_accountserver.
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp42
1 files changed, 14 insertions, 28 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 40d78248..bc81add5 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -62,6 +62,7 @@
#include "gui/status.h"
#include "gui/trade.h"
#include "gui/viewport.h"
+#include "gui/quitdialog.h"
#include "net/beinghandler.h"
#include "net/buysellhandler.h"
@@ -92,7 +93,7 @@ Joystick *joystick = NULL;
extern Window *weightNotice;
extern Window *deathNotice;
-ConfirmDialog *exitConfirm = NULL;
+QuitDialog *quitDialog = NULL;
ChatWindow *chatWindow;
MenuWindow *menuWindow;
@@ -121,22 +122,6 @@ FloorItemManager *floorItemManager = NULL;
const int MAX_TIME = 10000;
/**
- * Listener used for exitting handling.
- */
-namespace {
- struct ExitListener : public gcn::ActionListener
- {
- void action(const gcn::ActionEvent &event)
- {
- if (event.getId() == "yes") {
- done = true;
- }
- exitConfirm = NULL;
- }
- } exitListener;
-}
-
-/**
* Advances game logic counter.
*/
Uint32 nextTick(Uint32 interval, void *param)
@@ -245,6 +230,8 @@ Game::Game():
mSkillHandler(new SkillHandler()),
mTradeHandler(new TradeHandler())
{
+ done = false;
+
createGuiWindows();
engine = new Engine;
@@ -285,6 +272,8 @@ Game::Game():
Game::~Game()
{
+ Net::clearHandlers();
+
delete engine;
delete player_node;
destroyGuiWindows();
@@ -440,13 +429,8 @@ void Game::handleInput()
break;
}
- // Quit by pressing Enter if the exit confirm is there
- if (exitConfirm)
- {
- done = true;
- }
// Close the Browser if opened
- else if (helpWindow->isVisible())
+ if (helpWindow->isVisible())
{
helpWindow->setVisible(false);
}
@@ -522,12 +506,14 @@ void Game::handleInput()
// Quitting confirmation dialog
case SDLK_ESCAPE:
- if (!exitConfirm) {
- exitConfirm = new ConfirmDialog(
- "Quit", "Are you sure you want to quit?");
- exitConfirm->addActionListener(&exitListener);
+ if (!quitDialog)
+ {
+ quitDialog = new QuitDialog(&done, &quitDialog);
+ }
+ else
+ {
+ quitDialog->requestMoveToTop();
}
- exitConfirm->requestMoveToTop();
break;
default: