diff options
author | Reid <reidyaro@gmail.com> | 2012-01-25 22:05:36 +0100 |
---|---|---|
committer | Reid <reidyaro@gmail.com> | 2012-01-25 22:05:36 +0100 |
commit | 8b612abb42853a22c1a9545e2c9280d154646543 (patch) | |
tree | f466167087c2b2de4b8aa9e6d1d1986f72f84147 /src/gui/popupmenu.cpp | |
parent | a913dd41df61760de6ece552f941e002251ff54c (diff) | |
parent | d340b5a27a8f3b05d1764da9c114f5f59bd0cd46 (diff) | |
download | manaplus-8b612abb42853a22c1a9545e2c9280d154646543.tar.gz manaplus-8b612abb42853a22c1a9545e2c9280d154646543.tar.bz2 manaplus-8b612abb42853a22c1a9545e2c9280d154646543.tar.xz manaplus-8b612abb42853a22c1a9545e2c9280d154646543.zip |
Merge branch 'master' of gitorious.org:manaplus/manaplus
Diffstat (limited to 'src/gui/popupmenu.cpp')
-rw-r--r-- | src/gui/popupmenu.cpp | 62 |
1 files changed, 36 insertions, 26 deletions
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index 15afc7600..cd3a4c5ad 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -2,7 +2,7 @@ * The ManaPlus Client * Copyright (C) 2004-2009 The Mana World Development Team * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011 The ManaPlus Developers + * Copyright (C) 2011-2012 The ManaPlus Developers * * This file is part of The ManaPlus Client. * @@ -85,7 +85,7 @@ std::string tradePartnerName(""); PopupMenu::PopupMenu(): Popup("PopupMenu", "popupmenu.xml"), mBeingId(0), - mFloorItem(nullptr), + mFloorItemId(0), mItem(nullptr), mItemId(0), mItemColor(1), @@ -367,7 +367,7 @@ void PopupMenu::showPopup(int x, int y, std::vector<ActorSprite*> &beings) being->getId(), (being->getName() + being->getGenderSignWithSpace()).c_str())); } - else if(actor->getType() == ActorSprite::FLOOR_ITEM) + else if (actor->getType() == ActorSprite::FLOOR_ITEM) { FloorItem *floorItem = static_cast<FloorItem*>(actor); const ItemInfo &info = floorItem->getInfo(); @@ -529,7 +529,7 @@ void PopupMenu::showPopup(int x, int y, FloorItem *floorItem) if (!floorItem) return; - mFloorItem = floorItem; + mFloorItemId = floorItem->getId(); mX = x; mY = y; const ItemInfo &info = floorItem->getInfo(); @@ -586,7 +586,7 @@ void PopupMenu::showOutfitsPopup(int x, int y) mBrowserBox->clearRows(); mBrowserBox->addRow(_("Outfits")); - mBrowserBox->addRow("load old outfits", _("Load old outfits")); + mBrowserBox->addRow("clear outfit", _("Clear outfit")); mBrowserBox->addRow("##3---"); mBrowserBox->addRow("cancel", _("Cancel")); @@ -871,7 +871,7 @@ void PopupMenu::showChangePos(int x, int y) else { mBeingId = 0; - mFloorItem = nullptr; + mFloorItemId = 0; mItem = nullptr; mMapItem = nullptr; mNick = ""; @@ -1038,10 +1038,14 @@ void PopupMenu::handleLink(const std::string &link, player_node->setImitate(mNick); } // Pick Up Floor Item action - else if ((link == "pickup") && mFloorItem) + else if ((link == "pickup") && mFloorItemId) { - if (player_node) - player_node->pickUp(mFloorItem); + if (player_node && actorSpriteManager) + { + FloorItem *item = actorSpriteManager->findItem(mFloorItemId); + if (item) + player_node->pickUp(item); + } } // Look To action else if (link == "look") @@ -1106,16 +1110,21 @@ void PopupMenu::handleLink(const std::string &link, chatWindow->addItemText(mItem->getInfo().getName()); } } - else if (mFloorItem) + else if (mFloorItemId && actorSpriteManager) { - if (serverVersion > 0) - { - chatWindow->addItemText(mFloorItem->getInfo().getName( - mFloorItem->getColor())); - } - else + FloorItem *item = actorSpriteManager->findItem(mFloorItemId); + + if (item) { - chatWindow->addItemText(mFloorItem->getInfo().getName()); + if (serverVersion > 0) + { + chatWindow->addItemText(item->getInfo().getName( + item->getColor())); + } + else + { + chatWindow->addItemText(item->getInfo().getName()); + } } } } @@ -1331,11 +1340,6 @@ void PopupMenu::handleLink(const std::string &link, mDialog->setActionEventId("ok"); mDialog->addActionListener(&mRenameListener); } - else if (link == "load old outfits") - { - if (outfitWindow) - outfitWindow->load(true); - } else if (link == "load old spells") { if (spellManager) @@ -1673,6 +1677,11 @@ void PopupMenu::handleLink(const std::string &link, showChangePos(getX(), getY()); return; } + else if (link == "clear outfit") + { + if (outfitWindow) + outfitWindow->clearCurrentOutfit(); + } else if (!link.compare(0, 10, "guild-pos-")) { if (player_node) @@ -1706,10 +1715,11 @@ void PopupMenu::handleLink(const std::string &link, int id = atoi(link.substr(10).c_str()); if (id) { - mFloorItem = actorSpriteManager->findItem(id); - if (mFloorItem) + FloorItem *item = actorSpriteManager->findItem(id); + if (item) { - showPopup(getX(), getY(), mFloorItem); + mFloorItemId = item->getId(); + showPopup(getX(), getY(), item); return; } } @@ -1744,7 +1754,7 @@ void PopupMenu::handleLink(const std::string &link, setVisible(false); mBeingId = 0; - mFloorItem = nullptr; + mFloorItemId = 0; mItem = nullptr; mItemId = 0; mItemColor = 1; |