summaryrefslogtreecommitdiff
path: root/src/resources/db/npcdialogdb.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-10-28 23:59:44 +0300
committerAndrei Karas <akaras@inbox.ru>2015-10-28 23:59:44 +0300
commit5973d759a2473425e52efd066892c35ab7502ed1 (patch)
tree5ce6add127f3d3cffbb89fa7a66045cb9e0e67ae /src/resources/db/npcdialogdb.cpp
parented17aa400a745a81940020e024a3944671a47281 (diff)
downloadplus-5973d759a2473425e52efd066892c35ab7502ed1.tar.gz
plus-5973d759a2473425e52efd066892c35ab7502ed1.tar.bz2
plus-5973d759a2473425e52efd066892c35ab7502ed1.tar.xz
plus-5973d759a2473425e52efd066892c35ab7502ed1.zip
Move all npc dialog menu related skin elements into menu tag.
Diffstat (limited to 'src/resources/db/npcdialogdb.cpp')
-rw-r--r--src/resources/db/npcdialogdb.cpp34
1 files changed, 23 insertions, 11 deletions
diff --git a/src/resources/db/npcdialogdb.cpp b/src/resources/db/npcdialogdb.cpp
index 22dbb9b79..5d704b001 100644
--- a/src/resources/db/npcdialogdb.cpp
+++ b/src/resources/db/npcdialogdb.cpp
@@ -48,8 +48,8 @@ void NpcDialogDB::load()
mLoaded = true;
}
-static void loadNpcDialog(NpcDialogInfo *const dialog,
- const XmlNodePtrConst node)
+static void loadNpcDialogMenu(NpcDialogInfo *const dialog,
+ const XmlNodePtrConst node)
{
for_each_xml_child_node(childNode, node)
{
@@ -78,7 +78,7 @@ static void loadNpcDialog(NpcDialogInfo *const dialog,
childNode, "imageWidth", 16, 1, 1000);
button->imageHeight = XML::getIntProperty(
childNode, "imageHeight", 16, 1, 1000);
- dialog->buttons.push_back(button);
+ dialog->menu.buttons.push_back(button);
}
else if (xmlNameEqual(childNode, "image"))
{
@@ -94,7 +94,7 @@ static void loadNpcDialog(NpcDialogInfo *const dialog,
childNode, "x", 0, 0, 10000);
imageInfo->y = XML::getIntProperty(
childNode, "y", 0, 0, 10000);
- dialog->images.push_back(imageInfo);
+ dialog->menu.images.push_back(imageInfo);
}
else if (xmlNameEqual(childNode, "text"))
{
@@ -114,7 +114,19 @@ static void loadNpcDialog(NpcDialogInfo *const dialog,
childNode, "width", 20, 10, 10000);
textInfo->height = XML::getIntProperty(
childNode, "height", 20, 10, 10000);
- dialog->texts.push_back(textInfo);
+ dialog->menu.texts.push_back(textInfo);
+ }
+ }
+}
+
+static void loadNpcDialog(NpcDialogInfo *const dialog,
+ const XmlNodePtrConst node)
+{
+ for_each_xml_child_node(childNode, node)
+ {
+ if (xmlNameEqual(childNode, "menu"))
+ {
+ loadNpcDialogMenu(dialog, childNode);
}
}
}
@@ -167,9 +179,9 @@ void NpcDialogDB::deleteDialog(const std::string &name)
return;
NpcDialogInfo *dialog = (*it).second;
- delete_all(dialog->buttons);
- delete_all(dialog->images);
- delete_all(dialog->texts);
+ delete_all(dialog->menu.buttons);
+ delete_all(dialog->menu.images);
+ delete_all(dialog->menu.texts);
mDialogs.erase(it);
delete dialog;
}
@@ -181,9 +193,9 @@ void NpcDialogDB::unload()
FOR_EACH(DialogsIter, it, mDialogs)
{
NpcDialogInfo *dialog = (*it).second;
- delete_all(dialog->buttons);
- delete_all(dialog->images);
- delete_all(dialog->texts);
+ delete_all(dialog->menu.buttons);
+ delete_all(dialog->menu.images);
+ delete_all(dialog->menu.texts);
delete dialog;
}
mDialogs.clear();