diff options
author | Björn Steinbrink <B.Steinbrink@gmx.de> | 2005-07-26 20:07:20 +0000 |
---|---|---|
committer | Björn Steinbrink <B.Steinbrink@gmx.de> | 2005-07-26 20:07:20 +0000 |
commit | 1c43b2cdee5a5508a6e771b477100517deae07e7 (patch) | |
tree | 5a5df16ea526daed5b8268f26d4e63c76017dec4 /src/gui/popupmenu.cpp | |
parent | ea17e8e26173d641fc9b3710b65209c03af5aff3 (diff) | |
download | mana-1c43b2cdee5a5508a6e771b477100517deae07e7.tar.gz mana-1c43b2cdee5a5508a6e771b477100517deae07e7.tar.bz2 mana-1c43b2cdee5a5508a6e771b477100517deae07e7.tar.xz mana-1c43b2cdee5a5508a6e771b477100517deae07e7.zip |
Added Being::Type enumeration and type-aware findNode(). Fixed font not being reset after drawing speech. Target marker drawing moved into engine.
Diffstat (limited to 'src/gui/popupmenu.cpp')
-rw-r--r-- | src/gui/popupmenu.cpp | 45 |
1 files changed, 27 insertions, 18 deletions
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index 77f95d2f..18f90af5 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -70,22 +70,31 @@ void PopupMenu::showPopup(int mx, int my) mY = my; browserBox->clearRows(); - if (being && being->isNpc()) - { - // NPCs can be talked to (single option, candidate for removal unless - // more options would be added) - browserBox->addRow("@@talk|Talk To NPC@@"); - } - else if (being && being->isPlayer()) - { - // Players can be traded with. Later also attack, follow and add as - // buddy will be options in this menu. - - std::string name = being->name; - //browserBox->addRow("@@attack|Attack " + name + "@@"); - browserBox->addRow("@@trade|Trade With " + name + "@@"); - //browserBox->addRow("@@follow|Follow " + name + "@@"); - //browserBox->addRow("@@buddy|Add " + name + " to Buddy List@@"); + if (being) { + std::string name; + switch (being->getType()) + { + case Being::PLAYER: + // Players can be traded with. Later also attack, follow and + // add as buddy will be options in this menu. + + name = being->name; + //browserBox->addRow("@@attack|Attack " + name + "@@"); + browserBox->addRow("@@trade|Trade With " + name + "@@"); + //browserBox->addRow("@@follow|Follow " + name + "@@"); + //browserBox->addRow("@@buddy|Add " + name + " to Buddy List@@"); + break; + + case Being::NPC: + // NPCs can be talked to (single option, candidate for removal + // unless more options would be added) + browserBox->addRow("@@talk|Talk To NPC@@"); + break; + + default: + /* Other beings aren't interesting... */ + break; + } } else if (floorItem) { @@ -118,7 +127,7 @@ void PopupMenu::showPopup(int mx, int my) void PopupMenu::handleLink(const std::string& link) { // Talk To action - if ((link == "talk") && being && being->isNpc() && + if ((link == "talk") && being && being->getType() == Being::NPC && (current_npc == 0)) { WFIFOW(0) = net_w_value(0x0090); @@ -129,7 +138,7 @@ void PopupMenu::handleLink(const std::string& link) } // Trade action - else if ((link == "trade") && being && being->isPlayer()) + else if ((link == "trade") && being && being->getType() == Being::PLAYER) { WFIFOW(0) = net_w_value(0x00e4); WFIFOL(2) = net_l_value(being->getId()); |