summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-06-22 23:20:05 +0300
committerAndrei Karas <akaras@inbox.ru>2017-06-22 23:20:05 +0300
commit3c51082082397b0564a224214249a096750b56c6 (patch)
treefc4bb3b4d511842e2a9f0f608d51fb3539a40ae9 /src
parentf6596726b6978a7380de163740e6b65c8394ca42 (diff)
downloadmv-3c51082082397b0564a224214249a096750b56c6.tar.gz
mv-3c51082082397b0564a224214249a096750b56c6.tar.bz2
mv-3c51082082397b0564a224214249a096750b56c6.tar.xz
mv-3c51082082397b0564a224214249a096750b56c6.zip
Add chat command for return pet to egg.
Diffstat (limited to 'src')
-rw-r--r--src/actions/pets.cpp7
-rw-r--r--src/actions/pets.h1
-rw-r--r--src/dyetool/actions/pets.cpp1
-rw-r--r--src/enums/input/inputaction.h1
-rw-r--r--src/gui/popups/popupmenu.cpp13
-rw-r--r--src/input/inputactionmap.h6
-rw-r--r--src/input/pages/other.cpp6
7 files changed, 27 insertions, 8 deletions
diff --git a/src/actions/pets.cpp b/src/actions/pets.cpp
index 01542edf4..b989cfc5c 100644
--- a/src/actions/pets.cpp
+++ b/src/actions/pets.cpp
@@ -231,4 +231,11 @@ impHandler0(petDropLoot)
return true;
}
+impHandler0(petReturnToEgg)
+{
+ if (petHandler != nullptr)
+ petHandler->returnToEgg();
+ return true;
+}
+
} // namespace Actions
diff --git a/src/actions/pets.h b/src/actions/pets.h
index a3ac0795f..f607f474c 100644
--- a/src/actions/pets.h
+++ b/src/actions/pets.h
@@ -43,6 +43,7 @@ namespace Actions
decHandler(petMove);
decHandler(petFeed);
decHandler(petDropLoot);
+ decHandler(petReturnToEgg);
} // namespace Actions
#undef decHandler
diff --git a/src/dyetool/actions/pets.cpp b/src/dyetool/actions/pets.cpp
index 16658ebc7..b52c17020 100644
--- a/src/dyetool/actions/pets.cpp
+++ b/src/dyetool/actions/pets.cpp
@@ -43,5 +43,6 @@ impHandlerVoid(petDirectRight)
impHandlerVoid(petMove)
impHandlerVoid(petFeed)
impHandlerVoid(petDropLoot)
+impHandlerVoid(petReturnToEgg)
} // namespace Actions
diff --git a/src/enums/input/inputaction.h b/src/enums/input/inputaction.h
index 3099c89ea..3ec122683 100644
--- a/src/enums/input/inputaction.h
+++ b/src/enums/input/inputaction.h
@@ -706,6 +706,7 @@ enumStart(InputAction)
HOMUNCULUS_FEED,
PET_FEED,
PET_DROP_LOOT,
+ PET_RETURN_TO_EGG,
TOTAL
}
enumEnd(InputAction);
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp
index 0503e6e8f..d610182e6 100644
--- a/src/gui/popups/popupmenu.cpp
+++ b/src/gui/popups/popupmenu.cpp
@@ -396,13 +396,14 @@ void PopupMenu::showPopup(const int x, const int y, const Being *const being)
msg = info->getString(0);
if (!msg.empty())
{
- mBrowserBox->addRow("pet to egg", msg.c_str());
+ mBrowserBox->addRow("/petreturnegg", msg.c_str());
}
else
{
- // TRANSLATORS: popup menu item
- // TRANSLATORS: pet return to egg
- mBrowserBox->addRow("pet to egg", _("Return to egg"));
+ mBrowserBox->addRow("/petreturnegg",
+ // TRANSLATORS: popup menu item
+ // TRANSLATORS: pet return to egg
+ _("Return to egg"));
}
mBrowserBox->addRow("##3---");
}
@@ -1302,10 +1303,6 @@ void PopupMenu::handleLink(const std::string &link,
showCraftPopup();
return;
}
- else if (link == "pet to egg")
- {
- petHandler->returnToEgg();
- }
else if (link == "pet unequip")
{
petHandler->unequip();
diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h
index 6007a3007..e30e50ae3 100644
--- a/src/input/inputactionmap.h
+++ b/src/input/inputactionmap.h
@@ -5726,6 +5726,12 @@ static const InputActionData inputActionData
"petdroploot|petloot",
UseArgs_false,
Protected_true},
+ {"keyPetReturnToEgg",
+ defaultAction(&Actions::petReturnToEgg),
+ InputCondition::INGAME,
+ "pettoegg|petegg|petreturn|returnpet|petreturnegg",
+ UseArgs_false,
+ Protected_false},
};
#undef defaultAction
diff --git a/src/input/pages/other.cpp b/src/input/pages/other.cpp
index c215f2fd0..a33ede552 100644
--- a/src/input/pages/other.cpp
+++ b/src/input/pages/other.cpp
@@ -446,6 +446,12 @@ SetupActionData setupActionDataOther[] =
"",
},
{
+ // TRANSLATORS: input action name
+ N_("Return pet to egg"),
+ InputAction::PET_RETURN_TO_EGG,
+ "",
+ },
+ {
"",
InputAction::NO_VALUE,
""