summaryrefslogtreecommitdiff
path: root/src/gui/windows
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-11-12 21:34:36 +0300
committerAndrei Karas <akaras@inbox.ru>2015-11-12 21:34:36 +0300
commit2300cbef216ff22275854e7fe76752a31a947bdc (patch)
tree5768520a2b7412f414a445ca1544055a365d9574 /src/gui/windows
parent02f3db43e3cdf991f61778083c955ec7dadff446 (diff)
downloadmv-2300cbef216ff22275854e7fe76752a31a947bdc.tar.gz
mv-2300cbef216ff22275854e7fe76752a31a947bdc.tar.bz2
mv-2300cbef216ff22275854e7fe76752a31a947bdc.tar.xz
mv-2300cbef216ff22275854e7fe76752a31a947bdc.zip
Add support for invoke ground skill with text parameter.
Diffstat (limited to 'src/gui/windows')
-rw-r--r--src/gui/windows/skilldialog.cpp39
1 files changed, 35 insertions, 4 deletions
diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp
index 3567a23bb..60eb32b64 100644
--- a/src/gui/windows/skilldialog.cpp
+++ b/src/gui/windows/skilldialog.cpp
@@ -40,6 +40,10 @@
#include "gui/widgets/tabs/skilltab.h"
+#include "gui/windows/textdialog.h"
+
+#include "listeners/textskilllistener.h"
+
#include "net/playerhandler.h"
#include "net/skillhandler.h"
@@ -53,6 +57,11 @@
SkillDialog *skillDialog = nullptr;
+namespace
+{
+ TextSkillListener textSkillListener;
+} // namespace
+
static SkillOwner::Type parseOwner(const std::string &str)
{
if (str == "player")
@@ -687,7 +696,9 @@ void SkillDialog::useSkill(const SkillInfo *const info,
{
if (!info || !localPlayer)
return;
- const SkillData *const data = info->data;
+ const SkillData *data = info->data;
+ if (!data)
+ data = info->getData1(info->level);
if (data)
{
const std::string cmd = data->invokeCmd;
@@ -733,9 +744,29 @@ void SkillDialog::useSkill(const SkillInfo *const info,
int x = 0;
int y = 0;
viewport->getMouseTile(x, y);
- skillHandler->usePos(info->id,
- info->level,
- x, y);
+ if (info->useTextParameter)
+ {
+ textSkillListener.setSkill(info->id,
+ x,
+ y,
+ info->level);
+ TextDialog *const dialog = CREATEWIDGETR(TextDialog,
+ // TRANSLATORS: text skill dialog header
+ strprintf(_("Add text to skill %s"),
+ data->name.c_str()),
+ // TRANSLATORS: text skill dialog field
+ _("Text: "));
+ dialog->setModal(Modal_true);
+ textSkillListener.setDialog(dialog);
+ dialog->setActionEventId("ok");
+ dialog->addActionListener(&textSkillListener);
+ }
+ else
+ {
+ skillHandler->usePos(info->id,
+ info->level,
+ x, y);
+ }
break;
}