summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2011-04-18 00:06:56 +0200
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2011-04-18 01:14:12 +0200
commit88934303761ba950be56eac8b60de2dede88a29f (patch)
tree30ee10cfdd540a4b1af6e880778540954119a88f /src/game.cpp
parent76188096f64b8cc600d2f18cbf7a4d0c7ae87136 (diff)
downloadmana-client-88934303761ba950be56eac8b60de2dede88a29f.tar.gz
mana-client-88934303761ba950be56eac8b60de2dede88a29f.tar.bz2
mana-client-88934303761ba950be56eac8b60de2dede88a29f.tar.xz
mana-client-88934303761ba950be56eac8b60de2dede88a29f.zip
A bit of cleanup in the way the Client pops up error dialogs
No point in using mCurrentDialog for the OkDialog, since it will clean up after itself, as was pointed out in many places throughout the code. Now there are two convenience functions for popping up the OkDialog and having it change to a specified state afterwards. This also gets rid of the 4 different ActionListener classes that existed solely for this purpose. Reviewed-by: Yohann Ferreira
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp14
1 files changed, 3 insertions, 11 deletions
diff --git a/src/game.cpp b/src/game.cpp
index d2d2ecfd..8c8fb205 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -96,7 +96,6 @@ Joystick *joystick = NULL;
OkDialog *weightNotice = NULL;
OkDialog *deathNotice = NULL;
QuitDialog *quitDialog = NULL;
-OkDialog *disconnectedDialog = NULL;
ChatWindow *chatWindow;
StatusWindow *statusWindow;
@@ -226,8 +225,6 @@ Game::Game():
assert(!mInstance);
mInstance = this;
- disconnectedDialog = NULL;
-
// Create the viewport
viewport = new Viewport;
viewport->setDimension(gcn::Rectangle(0, 0, graphics->getWidth(),
@@ -386,14 +383,9 @@ void Game::logic()
return; // Disconnect gets handled by STATE_ERROR
errorMessage = _("The connection to the server was lost.");
-
- if (!disconnectedDialog)
- {
- disconnectedDialog = new OkDialog(_("Network Error"),
- errorMessage);
- disconnectedDialog->addActionListener(&errorListener);
- disconnectedDialog->requestMoveToTop();
- }
+ Client::instance()->showOkDialog(_("Network Error"),
+ errorMessage,
+ STATE_CHOOSE_SERVER);
}
}