diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-10-28 23:59:44 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-10-28 23:59:44 +0300 |
commit | 5973d759a2473425e52efd066892c35ab7502ed1 (patch) | |
tree | 5ce6add127f3d3cffbb89fa7a66045cb9e0e67ae /src/resources | |
parent | ed17aa400a745a81940020e024a3944671a47281 (diff) | |
download | manaplus-5973d759a2473425e52efd066892c35ab7502ed1.tar.gz manaplus-5973d759a2473425e52efd066892c35ab7502ed1.tar.bz2 manaplus-5973d759a2473425e52efd066892c35ab7502ed1.tar.xz manaplus-5973d759a2473425e52efd066892c35ab7502ed1.zip |
Move all npc dialog menu related skin elements into menu tag.
Diffstat (limited to 'src/resources')
-rw-r--r-- | src/resources/db/npcdialogdb.cpp | 34 | ||||
-rw-r--r-- | src/resources/npcdialoginfo.h | 8 |
2 files changed, 26 insertions, 16 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(); diff --git a/src/resources/npcdialoginfo.h b/src/resources/npcdialoginfo.h index e6fe6e331..c45ae3b6f 100644 --- a/src/resources/npcdialoginfo.h +++ b/src/resources/npcdialoginfo.h @@ -22,6 +22,7 @@ #define RESOURCES_NPCDIALOGINFO_H #include "resources/npcbuttoninfo.h" +#include "resources/npcdialogmenuinfo.h" #include "resources/npcimageinfo.h" #include "resources/npctextinfo.h" @@ -32,16 +33,13 @@ struct NpcDialogInfo final { NpcDialogInfo() : - buttons(), - images(), + menu(), name(), hideText(false) { } - std::vector<NpcButtonInfo*> buttons; - std::vector<NpcImageInfo*> images; - std::vector<NpcTextInfo*> texts; + NpcDialogMenuInfo menu; std::string name; bool hideText; }; |