summaryrefslogtreecommitdiff
path: root/src
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
parented17aa400a745a81940020e024a3944671a47281 (diff)
downloadmanaverse-5973d759a2473425e52efd066892c35ab7502ed1.tar.gz
manaverse-5973d759a2473425e52efd066892c35ab7502ed1.tar.bz2
manaverse-5973d759a2473425e52efd066892c35ab7502ed1.tar.xz
manaverse-5973d759a2473425e52efd066892c35ab7502ed1.zip
Move all npc dialog menu related skin elements into menu tag.
Diffstat (limited to 'src')
-rw-r--r--src/gui/windows/npcdialog.cpp12
-rw-r--r--src/resources/db/npcdialogdb.cpp34
-rw-r--r--src/resources/npcdialoginfo.h8
3 files changed, 35 insertions, 19 deletions
diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp
index f5639acd8..21c8fd577 100644
--- a/src/gui/windows/npcdialog.cpp
+++ b/src/gui/windows/npcdialog.cpp
@@ -1162,7 +1162,9 @@ void NpcDialog::createSkinControls()
}
mHideText = dialog->hideText;
- FOR_EACH (std::vector<NpcImageInfo*>::const_iterator, it, dialog->images)
+ FOR_EACH (std::vector<NpcImageInfo*>::const_iterator,
+ it,
+ dialog->menu.images)
{
const NpcImageInfo *const info = *it;
Image *const image = Theme::getImageFromTheme(info->name);
@@ -1173,7 +1175,9 @@ void NpcDialog::createSkinControls()
mSkinContainer->add(icon);
}
}
- FOR_EACH (std::vector<NpcTextInfo*>::const_iterator, it, dialog->texts)
+ FOR_EACH (std::vector<NpcTextInfo*>::const_iterator,
+ it,
+ dialog->menu.texts)
{
const NpcTextInfo *const info = *it;
BrowserBox *box = new BrowserBox(this,
@@ -1198,7 +1202,9 @@ void NpcDialog::createSkinControls()
box->addRow(*it2);
}
}
- FOR_EACH (std::vector<NpcButtonInfo*>::const_iterator, it, dialog->buttons)
+ FOR_EACH (std::vector<NpcButtonInfo*>::const_iterator,
+ it,
+ dialog->menu.buttons)
{
const NpcButtonInfo *const info = *it;
Button *const button = new Button(this);
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;
};