diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-10-28 21:02:57 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-10-28 22:52:27 +0300 |
commit | ed17aa400a745a81940020e024a3944671a47281 (patch) | |
tree | eac1fe8c0a1e4f1cac2fce2614c002dd449141dd /src/resources/db | |
parent | 519c7cfaccac61beaa84751b7dfeed1c50600bed (diff) | |
download | mv-ed17aa400a745a81940020e024a3944671a47281.tar.gz mv-ed17aa400a745a81940020e024a3944671a47281.tar.bz2 mv-ed17aa400a745a81940020e024a3944671a47281.tar.xz mv-ed17aa400a745a81940020e024a3944671a47281.zip |
Add text object to skined npc menus.
Diffstat (limited to 'src/resources/db')
-rw-r--r-- | src/resources/db/npcdialogdb.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/resources/db/npcdialogdb.cpp b/src/resources/db/npcdialogdb.cpp index 86bc712f2..22dbb9b79 100644 --- a/src/resources/db/npcdialogdb.cpp +++ b/src/resources/db/npcdialogdb.cpp @@ -96,6 +96,26 @@ static void loadNpcDialog(NpcDialogInfo *const dialog, childNode, "y", 0, 0, 10000); dialog->images.push_back(imageInfo); } + else if (xmlNameEqual(childNode, "text")) + { + const std::string text = XML::getProperty(childNode, "text", ""); + if (text.empty()) + { + logger->log("Error: no text attribute found in text tag."); + continue; + } + NpcTextInfo *const textInfo = new NpcTextInfo; + textInfo->text = text; + textInfo->x = XML::getIntProperty( + childNode, "x", 0, 0, 10000); + textInfo->y = XML::getIntProperty( + childNode, "y", 0, 0, 10000); + textInfo->width = XML::getIntProperty( + childNode, "width", 20, 10, 10000); + textInfo->height = XML::getIntProperty( + childNode, "height", 20, 10, 10000); + dialog->texts.push_back(textInfo); + } } } @@ -149,6 +169,7 @@ void NpcDialogDB::deleteDialog(const std::string &name) NpcDialogInfo *dialog = (*it).second; delete_all(dialog->buttons); delete_all(dialog->images); + delete_all(dialog->texts); mDialogs.erase(it); delete dialog; } @@ -162,6 +183,7 @@ void NpcDialogDB::unload() NpcDialogInfo *dialog = (*it).second; delete_all(dialog->buttons); delete_all(dialog->images); + delete_all(dialog->texts); delete dialog; } mDialogs.clear(); |