summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-10-30 23:57:54 +0300
committerAndrei Karas <akaras@inbox.ru>2015-10-30 23:57:54 +0300
commit382d24526919eafc08df19169046fdae190e10da (patch)
tree5eee2825a6a0dd282990c1a6a2f4a8e924c8083d /src/resources
parentbe1962973deaa161491b6592cbf21eb3e6700cc9 (diff)
downloadManaVerse-382d24526919eafc08df19169046fdae190e10da.tar.gz
ManaVerse-382d24526919eafc08df19169046fdae190e10da.tar.bz2
ManaVerse-382d24526919eafc08df19169046fdae190e10da.tar.xz
ManaVerse-382d24526919eafc08df19169046fdae190e10da.zip
Add support for npc dialog inventory theming from npc skin.
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/db/npcdialogdb.cpp12
-rw-r--r--src/resources/npcdialoginfo.h3
-rw-r--r--src/resources/npcinventoryinfo.h40
3 files changed, 55 insertions, 0 deletions
diff --git a/src/resources/db/npcdialogdb.cpp b/src/resources/db/npcdialogdb.cpp
index 5d704b001..365ed018e 100644
--- a/src/resources/db/npcdialogdb.cpp
+++ b/src/resources/db/npcdialogdb.cpp
@@ -119,6 +119,14 @@ static void loadNpcDialogMenu(NpcDialogInfo *const dialog,
}
}
+static void loadNpcDialogInventory(NpcDialogInfo *const dialog,
+ XmlNodePtrConst node)
+{
+ dialog->inventory.cell = XML::getProperty(node, "cell", "");
+ dialog->inventory.columns = XML::getIntProperty(
+ node, "columns", 10000, 1, 10000);
+}
+
static void loadNpcDialog(NpcDialogInfo *const dialog,
const XmlNodePtrConst node)
{
@@ -128,6 +136,10 @@ static void loadNpcDialog(NpcDialogInfo *const dialog,
{
loadNpcDialogMenu(dialog, childNode);
}
+ else if (xmlNameEqual(childNode, "inventory"))
+ {
+ loadNpcDialogInventory(dialog, childNode);
+ }
}
}
diff --git a/src/resources/npcdialoginfo.h b/src/resources/npcdialoginfo.h
index c45ae3b6f..d27804cd5 100644
--- a/src/resources/npcdialoginfo.h
+++ b/src/resources/npcdialoginfo.h
@@ -24,6 +24,7 @@
#include "resources/npcbuttoninfo.h"
#include "resources/npcdialogmenuinfo.h"
#include "resources/npcimageinfo.h"
+#include "resources/npcinventoryinfo.h"
#include "resources/npctextinfo.h"
#include "utils/stringvector.h"
@@ -34,12 +35,14 @@ struct NpcDialogInfo final
{
NpcDialogInfo() :
menu(),
+ inventory(),
name(),
hideText(false)
{
}
NpcDialogMenuInfo menu;
+ NpcInventoryInfo inventory;
std::string name;
bool hideText;
};
diff --git a/src/resources/npcinventoryinfo.h b/src/resources/npcinventoryinfo.h
new file mode 100644
index 000000000..494499851
--- /dev/null
+++ b/src/resources/npcinventoryinfo.h
@@ -0,0 +1,40 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2011-2015 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef RESOURCES_NPCINVENTORYINFO_H
+#define RESOURCES_NPCINVENTORYINFO_H
+
+#include <string>
+
+#include "localconsts.h"
+
+struct NpcInventoryInfo final
+{
+ NpcInventoryInfo() :
+ cell(),
+ columns(100000)
+ {
+ }
+
+ std::string cell;
+ int columns;
+};
+
+#endif // RESOURCES_NPCINVENTORYINFO_H