summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/db/npcdialogdb.cpp14
-rw-r--r--src/resources/npcbuttoninfo.h8
2 files changed, 18 insertions, 4 deletions
diff --git a/src/resources/db/npcdialogdb.cpp b/src/resources/db/npcdialogdb.cpp
index 628ee233e..cf334a601 100644
--- a/src/resources/db/npcdialogdb.cpp
+++ b/src/resources/db/npcdialogdb.cpp
@@ -56,9 +56,6 @@ static void loadNpcDialog(NpcDialogInfo *const dialog,
if (xmlNameEqual(childNode, "button"))
{
const std::string name = XML::getProperty(childNode, "name", "");
- if (name.empty())
- continue;
-
const std::string value = XML::getProperty(childNode, "value", "");
if (value.empty())
continue;
@@ -70,6 +67,17 @@ static void loadNpcDialog(NpcDialogInfo *const dialog,
childNode, "y", 0, 0, 10000);
button->name = name;
button->value = value;
+ button->image = XML::getProperty(childNode, "image", "");
+ if (button->name.empty() && button->image.empty())
+ {
+ logger->log("Error: npc button without name or image");
+ delete button;
+ continue;
+ }
+ button->imageWidth = XML::getIntProperty(
+ childNode, "imageWidth", 16, 1, 1000);
+ button->imageHeight = XML::getIntProperty(
+ childNode, "imageHeight", 16, 1, 1000);
dialog->buttons.push_back(button);
}
}
diff --git a/src/resources/npcbuttoninfo.h b/src/resources/npcbuttoninfo.h
index 19de87891..d54b7d94c 100644
--- a/src/resources/npcbuttoninfo.h
+++ b/src/resources/npcbuttoninfo.h
@@ -30,15 +30,21 @@ struct NpcButtonInfo final
NpcButtonInfo() :
name(),
value(),
+ image(),
x(0),
- y(0)
+ y(0),
+ imageWidth(16),
+ imageHeight(16)
{
}
std::string name;
std::string value;
+ std::string image;
int x;
int y;
+ int imageWidth;
+ int imageHeight;
};
#endif // RESOURCES_NPCBUTTONINFO_H