From 4ba35c456af28479b547f2ab2c0bd02c40c292f6 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 13 Oct 2015 23:39:29 +0300 Subject: Add npc attribute what allow or prevent removing npc after out of sight. New npc attribute: allowDelete --- src/resources/beinginfo.cpp | 3 ++- src/resources/beinginfo.h | 7 +++++++ src/resources/db/npcdb.cpp | 3 +++ 3 files changed, 12 insertions(+), 1 deletion(-) (limited to 'src/resources') diff --git a/src/resources/beinginfo.cpp b/src/resources/beinginfo.cpp index 1f1033e3c..5a36892d9 100644 --- a/src/resources/beinginfo.cpp +++ b/src/resources/beinginfo.cpp @@ -90,7 +90,8 @@ BeingInfo::BeingInfo() : mDeadDirectionType(1), mAttackDirectionType(1), mStaticMaxHP(false), - mTargetSelection(true) + mTargetSelection(true), + mAllowDelete(true) { SpriteDisplay display; display.sprites.push_back(SpriteReference::Empty); diff --git a/src/resources/beinginfo.h b/src/resources/beinginfo.h index 3429515e0..ad5f35a85 100644 --- a/src/resources/beinginfo.h +++ b/src/resources/beinginfo.h @@ -311,6 +311,12 @@ class BeingInfo final int getAttackDirectionType() const A_WARN_UNUSED { return mAttackDirectionType; } + void setAllowDelete(const bool b) + { mAllowDelete = b; } + + int getAllowDelete() const A_WARN_UNUSED + { return mAllowDelete; } + void setColorsList(const std::string &name); std::string getColor(const ItemColor idx) const A_WARN_UNUSED; @@ -365,6 +371,7 @@ class BeingInfo final int mAttackDirectionType; bool mStaticMaxHP; bool mTargetSelection; + bool mAllowDelete; }; typedef std::map BeingInfos; diff --git a/src/resources/db/npcdb.cpp b/src/resources/db/npcdb.cpp index 8b47d33b4..1d2cf4899 100644 --- a/src/resources/db/npcdb.cpp +++ b/src/resources/db/npcdb.cpp @@ -109,6 +109,9 @@ void NPCDB::loadXmlFile(const std::string &fileName) currentInfo->setAvatarId(fromInt(XML::getProperty( npcNode, "avatar", 0), BeingTypeId)); + currentInfo->setAllowDelete(XML::getBoolProperty(npcNode, + "allowDelete", true)); + SpriteDisplay display; for_each_xml_child_node(spriteNode, npcNode) { -- cgit v1.2.3-60-g2f50