From 0bf480113790977c33713b328b1754426af55fdc Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 27 Sep 2016 01:54:55 +0300 Subject: Add support for links to homunculuses. Format is: @@hID|@@ Example: [@@h6001|@@] --- src/gui/widgets/browserbox.cpp | 9 +++++++++ src/resources/db/homunculusdb.cpp | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index 16484bf87..182f10507 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -44,6 +44,7 @@ #include "resources/beinginfo.h" #include "resources/iteminfo.h" +#include "resources/db/homunculusdb.h" #include "resources/db/itemdb.h" #include "resources/db/monsterdb.h" #include "resources/db/petdb.h" @@ -270,6 +271,14 @@ void BrowserBox::addRow(const std::string &row, const bool atTop) if (info) bLink.caption = info->getName(); } + else if (!link.empty() && link[0] == 'h') + { // homunculus link + const BeingTypeId id = static_cast( + atoi(bLink.link.substr(1).c_str())); + BeingInfo *info = HomunculusDB::get(id); + if (info) + bLink.caption = info->getName(); + } else { // item link size_t idx = bLink.link.find(","); diff --git a/src/resources/db/homunculusdb.cpp b/src/resources/db/homunculusdb.cpp index 38ce44efe..42c3c2304 100644 --- a/src/resources/db/homunculusdb.cpp +++ b/src/resources/db/homunculusdb.cpp @@ -27,6 +27,7 @@ #include "utils/checkutils.h" #include "utils/dtor.h" +#include "utils/gettext.h" #include "configuration.h" @@ -93,6 +94,10 @@ void HomunculusDB::loadXmlFile(const std::string &fileName, currentInfo = new BeingInfo; currentInfo->setBlockType(BlockType::NONE); + currentInfo->setName(XML::langProperty( + // TRANSLATORS: unknown info name + homunculusNode, "name", _("unnamed"))); + BeingCommon::readBasicAttributes(currentInfo, homunculusNode, "attack"); BeingCommon::readWalkingAttributes(currentInfo, -- cgit v1.2.3-70-g09d2