summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Schilling <ablu.erikschilling@googlemail.com>2013-08-04 18:46:05 +0200
committerErik Schilling <ablu.erikschilling@googlemail.com>2013-08-26 22:56:47 +0200
commit7dc001eb32ae5345905e108741984258ee2f1813 (patch)
treee5436e5041906be13ddeb1918b2dba17cfbd90a7
parent1e5a15c0a5e24fb4b358fff75a7082d65496e1f9 (diff)
downloadmanaserv-7dc001eb32ae5345905e108741984258ee2f1813.tar.gz
manaserv-7dc001eb32ae5345905e108741984258ee2f1813.tar.bz2
manaserv-7dc001eb32ae5345905e108741984258ee2f1813.tar.xz
manaserv-7dc001eb32ae5345905e108741984258ee2f1813.zip
Allow multiple scopes (character and monster)
This allows you to avoid putting usually unnessecary load onto npcs if you only wanted to share an attribute between monsters and characters.
-rw-r--r--src/game-server/attributemanager.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/game-server/attributemanager.cpp b/src/game-server/attributemanager.cpp
index 4c17d6a0..9ed76640 100644
--- a/src/game-server/attributemanager.cpp
+++ b/src/game-server/attributemanager.cpp
@@ -134,25 +134,31 @@ void AttributeManager::readAttributeNode(xmlNodePtr attributeNode)
const std::string scope = utils::toUpper(
XML::getProperty(attributeNode, "scope", std::string()));
- if (scope == "CHARACTER")
+ bool hasScope = false;
+
+ if (scope.find("CHARACTER") != std::string::npos)
{
mAttributeScopes[CharacterScope][id] = attribute;
LOG_DEBUG("Attribute manager: attribute '" << id
<< "' added to default character scope.");
+ hasScope = true;
}
- else if (scope == "MONSTER")
+ if (scope.find("MONSTER") != std::string::npos)
{
mAttributeScopes[MonsterScope][id] = attribute;
LOG_DEBUG("Attribute manager: attribute '" << id
<< "' added to default monster scope.");
+ hasScope = true;
}
- else if (scope == "BEING")
+ if (scope == "BEING")
{
mAttributeScopes[BeingScope][id] = attribute;
LOG_DEBUG("Attribute manager: attribute '" << id
<< "' added to default being scope.");
+ hasScope = true;
}
- else
+
+ if (!hasScope)
{
LOG_WARN("Attribute manager: attribute '" << id
<< "' has no (valid) scope. Skipping...");