From 775404c84c3250225d43f10c4a5363e997618cb2 Mon Sep 17 00:00:00 2001 From: Rogier Polak Date: Fri, 23 Feb 2007 19:18:28 +0000 Subject: Added unregistering, logout_then_exit, switch_character and switch_accountserver. --- src/game.cpp | 42 ++++++++++++++---------------------------- 1 file changed, 14 insertions(+), 28 deletions(-) (limited to 'src/game.cpp') 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; @@ -120,22 +121,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. */ @@ -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: -- cgit v1.2.3-70-g09d2