From 05099e035729878893845b0598e20109f0c734fe Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 22 Feb 2015 21:30:10 +0300 Subject: Show popup menu pet control commands only for pet owner. --- src/being/being.h | 3 +++ src/gui/popups/popupmenu.cpp | 31 +++++++++++++++++-------------- 2 files changed, 20 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/being/being.h b/src/being/being.h index b587a8d1f..6e7fb346c 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -840,6 +840,9 @@ class Being notfinal : public ActorSprite, void setOwner(Being *const owner) { mOwner = owner; } + Being *getOwner() const + { return mOwner; } + void unassignPet(const Being *const pet); void removeAllPets(); diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index 9a998214f..7816b6887 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -334,20 +334,23 @@ void PopupMenu::showPopup(const int x, const int y, const Being *const being) break; case ActorType::Pet: - // TRANSLATORS: popup menu item - // TRANSLATORS: feed pet - mBrowserBox->addRow("pet feed", _("Feed")); - // TRANSLATORS: popup menu item - // TRANSLATORS: pet drop loot - mBrowserBox->addRow("pet drop loot", _("Drop loot")); - // TRANSLATORS: popup menu item - // TRANSLATORS: pet unequip item - mBrowserBox->addRow("pet unequip", _("Unequip")); - mBrowserBox->addRow("##3---"); - // TRANSLATORS: popup menu item - // TRANSLATORS: pet return to egg - mBrowserBox->addRow("pet to egg", _("Return to egg")); - mBrowserBox->addRow("##3---"); + if (being->getOwner() == localPlayer) + { + // TRANSLATORS: popup menu item + // TRANSLATORS: feed pet + mBrowserBox->addRow("pet feed", _("Feed")); + // TRANSLATORS: popup menu item + // TRANSLATORS: pet drop loot + mBrowserBox->addRow("pet drop loot", _("Drop loot")); + // TRANSLATORS: popup menu item + // TRANSLATORS: pet unequip item + mBrowserBox->addRow("pet unequip", _("Unequip")); + mBrowserBox->addRow("##3---"); + // TRANSLATORS: popup menu item + // TRANSLATORS: pet return to egg + mBrowserBox->addRow("pet to egg", _("Return to egg")); + mBrowserBox->addRow("##3---"); + } break; case ActorType::Avatar: -- cgit v1.2.3-70-g09d2