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 | |
parent | ea17e8e26173d641fc9b3710b65209c03af5aff3 (diff) | |
download | mana-client-1c43b2cdee5a5508a6e771b477100517deae07e7.tar.gz mana-client-1c43b2cdee5a5508a6e771b477100517deae07e7.tar.bz2 mana-client-1c43b2cdee5a5508a6e771b477100517deae07e7.tar.xz mana-client-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')
-rw-r--r-- | src/gui/minimap.cpp | 25 | ||||
-rw-r--r-- | src/gui/popupmenu.cpp | 45 |
2 files changed, 41 insertions, 29 deletions
diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index 98392adf..c733da42 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -91,18 +91,21 @@ void Minimap::draw(gcn::Graphics *graphics) being->x / 2 + getPadding() - 1, being->y / 2 + getTitleBarHeight() - 1, 3, 3)); } - else if (being->isPlayer()) + else { - // Other player dot - graphics->setColor(gcn::Color(61, 52, 209)); - graphics->fillRectangle(gcn::Rectangle( - being->x / 2 + getPadding(), - being->y / 2 + getTitleBarHeight(), 1, 1)); - } - else if (being->isMonster()) - { - // Enemy dot - graphics->setColor(gcn::Color(209, 52, 61)); + switch (being->getType()) { + case Being::PLAYER: + graphics->setColor(gcn::Color(61, 52, 209)); + break; + + case Being::MONSTER: + graphics->setColor(gcn::Color(209, 52, 61)); + break; + + default: + break; + } + graphics->fillRectangle(gcn::Rectangle( being->x / 2 + getPadding(), being->y / 2 + getTitleBarHeight(), 1, 1)); 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()); |