summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-12-09 23:08:16 +0300
committerAndrei Karas <akaras@inbox.ru>2014-12-09 23:08:16 +0300
commit248c845b6a09c436f3d8d69a859f1c34d91b7508 (patch)
tree93747da9c23e6849675f4ad15b12859fc7b6ed6b /src
parent7e437604c8de0784f1343e6e8aa01612a194c466 (diff)
downloadplus-248c845b6a09c436f3d8d69a859f1c34d91b7508.tar.gz
plus-248c845b6a09c436f3d8d69a859f1c34d91b7508.tar.bz2
plus-248c845b6a09c436f3d8d69a859f1c34d91b7508.tar.xz
plus-248c845b6a09c436f3d8d69a859f1c34d91b7508.zip
load npc menu.
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/Makefile.am1
-rw-r--r--src/resources/beinginfo.cpp5
-rw-r--r--src/resources/beinginfo.h4
-rw-r--r--src/resources/db/npcdb.cpp7
5 files changed, 18 insertions, 0 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 92bf0a7e1..062a2a5e7 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -596,6 +596,7 @@ SET(SRCS
resources/beingcommon.h
resources/beinginfo.cpp
resources/beinginfo.h
+ resources/beingmenuitem.h
resources/chatobject.h
resources/db/chardb.cpp
resources/db/chardb.h
diff --git a/src/Makefile.am b/src/Makefile.am
index e4c94eae2..c39c7938a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -726,6 +726,7 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \
resources/beingcommon.h \
resources/beinginfo.cpp \
resources/beinginfo.h \
+ resources/beingmenuitem.h \
resources/chatobject.h \
resources/db/chardb.cpp \
resources/db/chardb.h \
diff --git a/src/resources/beinginfo.cpp b/src/resources/beinginfo.cpp
index 5f1704b88..8b9d72376 100644
--- a/src/resources/beinginfo.cpp
+++ b/src/resources/beinginfo.cpp
@@ -214,3 +214,8 @@ std::string BeingInfo::getColor(const int idx) const
return std::string();
return it->second.color;
}
+
+void BeingInfo::addMenu(const std::string &name, const std::string &command)
+{
+ mMenu.push_back(BeingMenuItem(name, command));
+}
diff --git a/src/resources/beinginfo.h b/src/resources/beinginfo.h
index 76955d2dd..aefd7a5ca 100644
--- a/src/resources/beinginfo.h
+++ b/src/resources/beinginfo.h
@@ -27,6 +27,7 @@
#include "being/targetcursorsize.h"
+#include "resources/beingmenuitem.h"
#include "resources/soundinfo.h"
#include "resources/spritedisplay.h"
@@ -315,6 +316,8 @@ class BeingInfo final
std::string getColor(const int idx) const A_WARN_UNUSED;
+ void addMenu(const std::string &name, const std::string &command);
+
static void init();
static void clear();
@@ -326,6 +329,7 @@ class BeingInfo final
Cursor::Cursor mHoverCursor;
ItemSoundEvents mSounds;
Attacks mAttacks;
+ std::vector<BeingMenuItem> mMenu;
unsigned char mBlockWalkMask;
BlockType::BlockType mBlockType;
const std::map <int, ColorDB::ItemColor> *mColors;
diff --git a/src/resources/db/npcdb.cpp b/src/resources/db/npcdb.cpp
index 2c840ace2..542724e27 100644
--- a/src/resources/db/npcdb.cpp
+++ b/src/resources/db/npcdb.cpp
@@ -127,6 +127,13 @@ void NPCDB::loadXmlFile(const std::string &fileName)
display.particles.push_back(reinterpret_cast<const char*>(
spriteNode->xmlChildrenNode->content));
}
+ else if (xmlNameEqual(spriteNode, "menu"))
+ {
+ std::string name = XML::getProperty(spriteNode, "name", "");
+ std::string command = XML::getProperty(spriteNode,
+ "command", "");
+ currentInfo->addMenu(name, command);
+ }
}
currentInfo->setDisplay(display);