summaryrefslogtreecommitdiff
path: root/src/progs/manaverse/actions/commands.cpp
diff options
context:
space:
mode:
authorFedja Beader <fedja@protonmail.ch>2025-06-05 21:24:33 +0000
committerFedja Beader <fedja@protonmail.ch>2025-06-05 21:24:33 +0000
commit16484e1dfcb01de3a7e2ac52b26ff44ff600427d (patch)
tree949287805a429290ac307f0409dbae62f695fa66 /src/progs/manaverse/actions/commands.cpp
parenta12c3f03564bfa6217fc32cd0031c952b1499ea3 (diff)
downloadmanaplus-16484e1dfcb01de3a7e2ac52b26ff44ff600427d.tar.gz
manaplus-16484e1dfcb01de3a7e2ac52b26ff44ff600427d.tar.bz2
manaplus-16484e1dfcb01de3a7e2ac52b26ff44ff600427d.tar.xz
manaplus-16484e1dfcb01de3a7e2ac52b26ff44ff600427d.zip
Add a confirmation dialog for killing/firing/dismissing your homunculous
- [x] Something needs to be done about that deletion as it may leak memory. Ditto for inputActionReplayListener (for EditDialog) - [x] Okay, that M+ -> MV rename must be completed to make the linters pass. Rename was completed and it works, proper cleanup happens in scheduleDelete, so that's not an issue either. Squashed with: * Actually fire homun (code was set to only change name, for testing of replay stuff) * Clarify my worries **** mana/plus!109
Diffstat (limited to 'src/progs/manaverse/actions/commands.cpp')
-rw-r--r--src/progs/manaverse/actions/commands.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/progs/manaverse/actions/commands.cpp b/src/progs/manaverse/actions/commands.cpp
index 9a622b627..668c54b80 100644
--- a/src/progs/manaverse/actions/commands.cpp
+++ b/src/progs/manaverse/actions/commands.cpp
@@ -58,6 +58,7 @@
#include "input/inputactionoperators.h"
#include "listeners/inputactionreplaylistener.h"
+#include "listeners/inputactionreplayconfirmlistener.h"
#include "net/adminhandler.h"
#include "net/chathandler.h"
@@ -966,7 +967,22 @@ impHandler(setHomunculusName)
impHandler0(fireHomunculus)
{
- if (homunculusHandler != nullptr)
+ const HomunculusInfo *const info = PlayerInfo::getHomunculus();
+ if (info == nullptr)
+ return false;
+
+ const std::string &args = event.args;
+ if (args.empty())
+ {
+ inputActionReplayConfirmListener.openDialog(
+ // TRANSLATORS: dialog title
+ _("Really?"),
+ // TRANSLATORS: dialog question
+ _("Really kill your homunculous? This is irreversible!"),
+ InputAction::HOMUNCULUS_FIRE);
+ return true;
+ }
+ else if (args == "yes" && homunculusHandler != nullptr)
{
homunculusHandler->fire();
return true;