summaryrefslogtreecommitdiff
path: root/src/engine.cpp
diff options
context:
space:
mode:
authorYohann Ferreira <bertram@cegetel.net>2005-05-07 18:39:04 +0000
committerYohann Ferreira <bertram@cegetel.net>2005-05-07 18:39:04 +0000
commit4d4c38ecca3a5c250ce49e769b6a2f6f42cfca39 (patch)
treecc4bba9cc47b66a9caf059b23b86daceb7f7d602 /src/engine.cpp
parent518987f93a9723cdde25a2c23800e7476b396cee (diff)
downloadmana-4d4c38ecca3a5c250ce49e769b6a2f6f42cfca39.tar.gz
mana-4d4c38ecca3a5c250ce49e769b6a2f6f42cfca39.tar.bz2
mana-4d4c38ecca3a5c250ce49e769b6a2f6f42cfca39.tar.xz
mana-4d4c38ecca3a5c250ce49e769b6a2f6f42cfca39.zip
Now you get a confirmation dialog before exitting.
Diffstat (limited to 'src/engine.cpp')
-rw-r--r--src/engine.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/engine.cpp b/src/engine.cpp
index a16c7e2c..65fbc431 100644
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -66,8 +66,24 @@ EquipmentWindow *equipmentWindow;
ChargeDialog *chargeDialog;
TradeWindow *tradeWindow;
RequestTradeDialog *requestTradeDialog;
+ConfirmDialog *quitDialog;
std::vector<Spriteset*> monsterset;
+/**
+ * Listener used for exitting handling.
+ */
+class ExitListener : public gcn::ActionListener {
+ void action(const std::string &eventId) {
+ if (eventId == "yes") {
+ state = EXIT;
+ }
+ else
+ {
+ quitDialog->setVisible(false);
+ }
+ }
+} exitListener;
+
char hairtable[16][4][2] = {
// S(x,y) W(x,y) N(x,y) E(x,y)
{ { 0, 0}, {-1, 2}, {-1, 2}, { 0, 2} }, // STAND
@@ -164,6 +180,7 @@ Engine::Engine()
chargeDialog = new ChargeDialog();
tradeWindow = new TradeWindow();
requestTradeDialog = new RequestTradeDialog();
+ quitDialog = new ConfirmDialog("Quit", "Are you sure you want to quit ?", (gcn::ActionListener*)&exitListener);
// Initialize window posisitons
chatWindow->setPosition(0, screen->h - chatWindow->getHeight());
statusWindow->setPosition(screen->w - statusWindow->getWidth() - 5, 5);
@@ -204,6 +221,7 @@ Engine::Engine()
chargeDialog->setVisible(false);
tradeWindow->setVisible(false);
requestTradeDialog->setVisible(false);
+ quitDialog->setVisible(false);
// Do not focus any text field
gui->focusNone();
@@ -254,6 +272,7 @@ Engine::~Engine()
delete itemAmountWindow;
delete tradeWindow;
delete requestTradeDialog;
+ delete quitDialog;
// Delete sprite sets
//delete monsterset;