From 382d24526919eafc08df19169046fdae190e10da Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 30 Oct 2015 23:57:54 +0300 Subject: Add support for npc dialog inventory theming from npc skin. --- src/resources/db/npcdialogdb.cpp | 12 ++++++++++++ src/resources/npcdialoginfo.h | 3 +++ src/resources/npcinventoryinfo.h | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+) create mode 100644 src/resources/npcinventoryinfo.h (limited to 'src/resources') 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 . + */ + +#ifndef RESOURCES_NPCINVENTORYINFO_H +#define RESOURCES_NPCINVENTORYINFO_H + +#include + +#include "localconsts.h" + +struct NpcInventoryInfo final +{ + NpcInventoryInfo() : + cell(), + columns(100000) + { + } + + std::string cell; + int columns; +}; + +#endif // RESOURCES_NPCINVENTORYINFO_H -- cgit v1.2.3-70-g09d2