summaryrefslogtreecommitdiff
path: root/src/game-server/attributemanager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game-server/attributemanager.cpp')
-rw-r--r--src/game-server/attributemanager.cpp34
1 files changed, 21 insertions, 13 deletions
diff --git a/src/game-server/attributemanager.cpp b/src/game-server/attributemanager.cpp
index 018de28e..42c2624d 100644
--- a/src/game-server/attributemanager.cpp
+++ b/src/game-server/attributemanager.cpp
@@ -144,13 +144,15 @@ void AttributeManager::readAttributeNode(xmlNodePtr attributeNode)
return;
}
- mAttributeMap[id].modifiers = std::vector<AttributeModifier>();
- mAttributeMap[id].minimum = XML::getFloatProperty(attributeNode, "minimum",
- std::numeric_limits<double>::min());
- mAttributeMap[id].maximum = XML::getFloatProperty(attributeNode, "maximum",
- std::numeric_limits<double>::max());
- mAttributeMap[id].modifiable = XML::getBoolProperty(attributeNode, "modifiable",
- false);
+ AttributeInfo &attribute = mAttributeMap[id];
+
+ attribute.modifiers = std::vector<AttributeModifier>();
+ attribute.minimum = XML::getFloatProperty(attributeNode, "minimum",
+ std::numeric_limits<double>::min());
+ attribute.maximum = XML::getFloatProperty(attributeNode, "maximum",
+ std::numeric_limits<double>::max());
+ attribute.modifiable = XML::getBoolProperty(attributeNode, "modifiable",
+ false);
for_each_xml_child_node(subNode, attributeNode)
{
@@ -171,22 +173,19 @@ void AttributeManager::readAttributeNode(xmlNodePtr attributeNode)
}
else if (scope == "CHARACTER")
{
- mAttributeScopes[CharacterScope][id] =
- &mAttributeMap.at(id);
+ mAttributeScopes[CharacterScope][id] = &attribute;
LOG_DEBUG("Attribute manager: attribute '" << id
<< "' added to default character scope.");
}
else if (scope == "MONSTER")
{
- mAttributeScopes[MonsterScope][id] =
- &mAttributeMap.at(id);
+ mAttributeScopes[MonsterScope][id] = &attribute;
LOG_DEBUG("Attribute manager: attribute '" << id
<< "' added to default monster scope.");
}
else if (scope == "BEING")
{
- mAttributeScopes[BeingScope][id] =
- &mAttributeMap.at(id);
+ mAttributeScopes[BeingScope][id] = &attribute;
LOG_DEBUG("Attribute manager: attribute '" << id
<< "' added to default being scope.");
}
@@ -250,6 +249,15 @@ void AttributeManager::readModifierNode(xmlNodePtr modifierNode,
return;
}
+ if (stackableType == NonStackable && effectType == Multiplicative)
+ {
+ LOG_WARN("Attribute manager: attribute '" << attributeId
+ << "' has a non sense modifier. "
+ << "Having NonStackable and Multiplicative makes no sense! "
+ << "Skipping modifier!");
+ return;
+ }
+
mAttributeMap[attributeId].modifiers.push_back(
AttributeModifier(stackableType, effectType));