summaryrefslogtreecommitdiff
path: root/src/listeners/playerpostdeathlistener.h
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-12-02 12:53:06 +0300
committerAndrei Karas <akaras@inbox.ru>2014-12-02 12:53:06 +0300
commitc26b6e2c74750c1f4f99ef5d673ea6fc2aac767b (patch)
treea292a697a38e6bc3b5992ee2f7e4ac2e55b96a52 /src/listeners/playerpostdeathlistener.h
parent892424cc005d41b8976ae9193a3a4161b5c1950f (diff)
downloadmanaplus-c26b6e2c74750c1f4f99ef5d673ea6fc2aac767b.tar.gz
manaplus-c26b6e2c74750c1f4f99ef5d673ea6fc2aac767b.tar.bz2
manaplus-c26b6e2c74750c1f4f99ef5d673ea6fc2aac767b.tar.xz
manaplus-c26b6e2c74750c1f4f99ef5d673ea6fc2aac767b.zip
Rename PlayerDeathListener into PlayerPostDeathListener.
Diffstat (limited to 'src/listeners/playerpostdeathlistener.h')
-rw-r--r--src/listeners/playerpostdeathlistener.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/src/listeners/playerpostdeathlistener.h b/src/listeners/playerpostdeathlistener.h
new file mode 100644
index 000000000..6ab8fd25b
--- /dev/null
+++ b/src/listeners/playerpostdeathlistener.h
@@ -0,0 +1,63 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2004-2009 The Mana World Development Team
+ * Copyright (C) 2009-2010 The Mana Developers
+ * Copyright (C) 2011-2014 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef LISTENERS_PLAYERDEATHLISTENER_H
+#define LISTENERS_PLAYERDEATHLISTENER_H
+
+#include "being/localplayer.h"
+
+#include "gui/dialogsmanager.h"
+#include "gui/popupmanager.h"
+
+#include "gui/windows/okdialog.h"
+#include "gui/windows/npcdialog.h"
+
+#include "net/net.h"
+#include "net/playerhandler.h"
+
+#include "localconsts.h"
+
+extern OkDialog *deathNotice;
+
+/**
+ * Listener used for handling death message.
+ */
+struct PlayerPostDeathListener final : public ActionListener
+{
+ void action(const ActionEvent &event A_UNUSED)
+ {
+ if (playerHandler)
+ playerHandler->respawn();
+ deathNotice = nullptr;
+
+ DialogsManager::closeDialogs();
+
+ if (popupManager)
+ popupManager->closePopupMenu();
+
+ NpcDialog::clearDialogs();
+ if (localPlayer)
+ localPlayer->respawn();
+ }
+};
+
+#endif // LISTENERS_PLAYERDEATHLISTENER_H