diff options
author | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-11-09 03:45:42 +0100 |
---|---|---|
committer | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2012-02-02 15:35:17 +0100 |
commit | 1e562bdd132c4166ca4de2bdb3f241adaa9a7149 (patch) | |
tree | 84bca9f39cfd3c05d3a315c8e9cd854b18cb4682 | |
parent | 4cd1957231605e976c5cf001eddea80d5e49272f (diff) | |
download | manaserv-1e562bdd132c4166ca4de2bdb3f241adaa9a7149.tar.gz manaserv-1e562bdd132c4166ca4de2bdb3f241adaa9a7149.tar.xz manaserv-1e562bdd132c4166ca4de2bdb3f241adaa9a7149.zip |
Added a way to specify the min and max attributes values.
This can now be done in attributes.xml through the
minimum and maximum attribute parameters.
I also changed the AttributeInfo struct as requested by bjorn.
Reviewed-by: Erik Schilling, Thorbjørn Lindeijer
-rw-r--r-- | example/clientdata/attributes.xml | 157 | ||||
-rw-r--r-- | src/common/defines.h | 32 | ||||
-rw-r--r-- | src/game-server/attribute.cpp | 42 | ||||
-rw-r--r-- | src/game-server/attribute.h | 14 | ||||
-rw-r--r-- | src/game-server/attributemanager.cpp | 38 | ||||
-rw-r--r-- | src/game-server/attributemanager.h | 62 | ||||
-rw-r--r-- | src/game-server/being.cpp | 4 | ||||
-rw-r--r-- | src/game-server/character.cpp | 6 | ||||
-rw-r--r-- | src/game-server/monster.cpp | 6 | ||||
-rw-r--r-- | src/game-server/monstermanager.cpp | 6 |
10 files changed, 264 insertions, 103 deletions
diff --git a/example/clientdata/attributes.xml b/example/clientdata/attributes.xml index 7501f14..69346e5 100644 --- a/example/clientdata/attributes.xml +++ b/example/clientdata/attributes.xml @@ -6,75 +6,188 @@ <!-- First Candidate for TMW attributes definitions --> <!-- The id are linked to the engine core. Do not change them. --> - <attribute id="1" name="Strength" desc="Increases carrying capacity and increases damage for many melee weapons." modifiable="true" scope="character"> + <attribute id="1" name="Strength" + desc="Increases carrying capacity and increases damage for many melee weapons." + modifiable="true" + scope="character" + minimum="0" + maximum="255"> <modifier stacktype="stackable" modtype="additive" tag="str" effect="Strength %+.1f" /> </attribute> - <attribute id="2" name="Agility" desc="Increases attack speed, conventional dodge, and also slightly increases movement speed." modifiable="true" scope="character"> + <attribute id="2" name="Agility" + desc="Increases attack speed, conventional dodge, and also slightly increases movement speed." + modifiable="true" + scope="character" + minimum="0" + maximum="255"> <modifier stacktype="stackable" modtype="additive" tag="agi" effect="Agility %+.1f" /> </attribute> - <attribute id="3" name="Vitality" desc="Increases the maximum number of hitpoints, defence, and also slightly increase hitpoint regeneration." modifiable="true" scope="character"> + <attribute id="3" name="Vitality" + desc="Increases the maximum number of hitpoints, defence, and also slightly increase hitpoint regeneration." + modifiable="true" + scope="character" + minimum="0" + maximum="255"> <modifier stacktype="stackable" modtype="additive" tag="vit" effect="Vitality %+.1f" /> </attribute> - <attribute id="4" name="Intelligence" desc="Involved in magic. So better not put too much in it for now..." modifiable="true" scope="character"> + <attribute id="4" name="Intelligence" + desc="Involved in magic. So better not put too much in it for now..." + modifiable="true" + scope="character" + minimum="0" + maximum="255"> <modifier stacktype="stackable" modtype="additive" tag="int" effect="Intelligence %+.1f" /> </attribute> - <attribute id="5" name="Dexterity" desc="Increases conventional accuracy, decreases the proportion of warmup time to cooldown time for conventional attacks and increases the damage for many ranged weapons." modifiable="true" scope="character"> + <attribute id="5" name="Dexterity" + desc="Increases conventional accuracy, decreases the proportion of warmup time to cooldown time for conventional attacks and increases the damage for many ranged weapons." + modifiable="true" + scope="character" + minimum="0" + maximum="255"> <modifier stacktype="stackable" modtype="additive" tag="dex" effect="Dexterity %+.1f" /> </attribute> - <attribute id="6" name="Willpower" desc="Increases magical dodge and decreases the proportion of warmup time to cooldown time for magical attacks." modifiable="true" scope="character"> + <attribute id="6" name="Willpower" + desc="Increases magical dodge and decreases the proportion of warmup time to cooldown time for magical attacks." + modifiable="true" + scope="character" + minimum="0" + maximum="255"> <modifier stacktype="stackable" modtype="additive" tag="wil" effect="Willpower %+.1f" /> </attribute> - <attribute id="7" name="Accuracy" desc="Increases the chance of outgoing physical attacks hitting their target." modifiable="false" scope="being"> + <attribute id="7" name="Accuracy" + desc="Increases the chance of outgoing physical attacks hitting their target." + modifiable="false" + scope="being" + minimum="0" + maximum="100"> <modifier stacktype="stackable" modtype="additive" tag="acc1" effect="Accuracy %+.1f" /> <modifier stacktype="stackable" modtype="multiplicative" tag="acc2" /> </attribute> - <attribute id="8" name="Defense" desc="Reduces incoming conventional damage." modifiable="false" scope="being"> + <attribute id="8" name="Defense" + desc="Reduces incoming conventional damage." + modifiable="false" + scope="being" + minimum="0" + maximum="255"> <modifier stacktype="stackable" modtype="additive" tag="def1" effect="Defense %+.1f" /> <modifier stacktype="non stackable bonus" modtype="multiplicative" tag="def2" effect="Defense x%.3f" additional="This modifier does not stack with other ##1Greater##0 defensive type effects." /> </attribute> - <attribute id="9" name="Dodge" desc="Decreases the chance of incoming physical attacks hitting you." modifiable="false" scope="being"> + <attribute id="9" name="Dodge" + desc="Decreases the chance of incoming physical attacks hitting you." + modifiable="false" + scope="being" + minimum="0" + maximum="100"> <modifier stacktype="non stackable bonus" modtype="additive" tag="dge" effect="Dodge %+.2f. This modifier does not stack with other dodge modifiers. "/> </attribute> - <attribute id="10" name="M. dodge" desc="Decreases the chance of incoming magical attacks hitting you." modifiable="false" scope="being"> + <attribute id="10" name="M. dodge" + desc="Decreases the chance of incoming magical attacks hitting you." + modifiable="false" + scope="being" + minimum="0" + maximum="100"> <modifier stacktype="stackable" modtype="additive" tag="mdge" effect="Magical dodge %+.2f"/> </attribute> - <attribute id="11" name="M. defense" desc="Reduces incoming magical damage." modifiable="false" scope="being"> + <attribute id="11" name="M. defense" + desc="Reduces incoming magical damage." + modifiable="false" + scope="being" + minimum="0" + maximum="255"> <modifier stacktype="non stackable bonus" modtype="additive" tag="mdef" effect="Magical defense %+.1f" additional="This modifier does not stack with other ##1Magical defense##0 modifiers." /> <!-- should this be non stackable instead of non stackable bonus? --> </attribute> - <attribute id="12" name="Bonus att. speed" tag="aspd" effect="Bonus attack speed %+f" desc="Increases the attack speed of all active auto-attacks." modifiable="false" scope="being"> + <attribute id="12" name="Bonus att. speed" + tag="aspd" + effect="Bonus attack speed %+f" + desc="Increases the attack speed of all active auto-attacks." + modifiable="false" + scope="being" + minimum="0" + maximum="255"> <modifier stacktype="non stackable" modtype="additive" tag="aspd1" /> <modifier stacktype="stackable" modtype="multiplicative" tag="aspd2" /> <modifier stacktype="stackable" modtype="additive" tag="aspd3" /> <modifier stacktype="non stackable bonus" modtype="multiplicative" tag="aspd4" /> </attribute> - <attribute id="13" name="HP" desc="The number of hitpoints this being has. When this drops below 0, the being dies." modifiable="false" scope="being" player-info="hp"> + <attribute id="13" name="HP" + desc="The number of hitpoints this being has. When this drops below 0, the being dies." + modifiable="false" + scope="being" + minimum="0" + maximum="9999" + player-info="hp"> <modifier stacktype="stackable" modtype="additive" tag="hp" effect="Hitpoints %+.1f" additional="The modifier will still be removed normally, increasing or decreasing hp as relevant." /> <!-- Not a typo. I really am allowing modifiers to be applied here. Most normal attacks will affect the base value, but interesting things happen when either bonus of malus effects here expire... :] --> </attribute> - <attribute id="14" name="Max HP" desc="The maximum number of hitpoints this being can have." modifiable="false" scope="being" player-info="max-hp"> + <attribute id="14" name="Max HP" + desc="The maximum number of hitpoints this being can have." + modifiable="false" + scope="being" + minimum="0" + maximum="9999" + player-info="max-hp"> <modifier stacktype="stackable" modtype="additive" tag="mhp1" effect="Max hp %+.1f" /> <modifier stacktype="non stackable bonus" modtype="multiplicative" tag="mhp2" effect="Max hp x%.3f" additional="This modifier does not stack with other ##1Lesser##0 max hp type effects." /> <modifier stacktype="non stackable bonus" modtype="additive" tag="mhp3" effect="Max hp %+.1f" additional="This modifier does not stack with other ##1Greater##0 max hp type effects." /> <modifier stacktype="non stackable bonus" modtype="multiplicative" tag="mhp4" effect="Max hp x%.3f" additional="This modifier does not stack with other ##1Major##0 max hp type effects." /> </attribute> - <attribute id="15" name="HP regeneration" tag="hpregen" effect="hp regen %+f" desc="The rate at which hitpoints are automatically replenished." modifiable="false" scope="character"> + <attribute id="15" name="HP regeneration" + tag="hpregen" + effect="hp regen %+f" + desc="The rate at which hitpoints are automatically replenished." + modifiable="false" + scope="character" + minimum="0" + maximum="100"> <modifier stacktype="non stackable bonus" modtype="multiplicative" tag="hpr1" effect="You shouldn't be seeing this. Items shouldn't be affecting this layer." /> <!-- Reserved for map effects --> <modifier stacktype="non stackable bonus" modtype="multiplicative" tag="hpr2" effect="Hitpoint regeneration x%.3f" additional="This modifier does not stack with other ##1Basic##0 hitpoint regeneration type effects."/> <!-- Reserved for passive item effects --> <modifier stacktype="stackable" modtype="multiplicative" tag="hpr3" effect="Hitpoint regeneration x%.3f" /> <!-- Reserved for active effects --> <modifier stacktype="stackable" modtype="additive" tag="hpr4" effect="Hitpoint regeneration %+.3f" /> <!-- General purpose --> <modifier stacktype="non stackable bonus" modtype="multiplicative" tag="hpr5" effect="Hitpoint regeneration x%.4f" additional="This modifier does not stack with other ##1Greater##0 hitpoint regeneration type effects." /> <!-- For *Very* powerful effects only --> </attribute> - <attribute id="16" name="Movement speed" desc="The speed at which this being moves in tiles per second." modifiable="false" scope="being"> + <attribute id="16" name="Movement speed" + desc="The speed at which this being moves in tiles per second." + modifiable="false" + scope="being" + minimum="0" + maximum="7"> <modifier stacktype="non stackable bonus" modtype="additive" tag="mspd" effect="Movement speed %+.2f" additional="This modifier does not stack with other ##1Movement speed##0 type effects." /> </attribute> - <attribute id="17" name="Movement speed (raw)" desc="The raw movement speed of this being." modifiable="false" scope="being" player-info="none" /> - <attribute id="18" name="gp" desc="The number of gold pieces this being possesses." modifiable="false" scope="character" player-info="money" /> - <attribute id="19" name="Capacity" desc="The capacity of this character." modifiable="false" scope="character" player-info="max-weight" > + <attribute id="17" name="Movement speed (raw)" + desc="The raw movement speed of this being." + modifiable="false" + scope="being" + player-info="none" /> + <attribute id="18" name="gp" + desc="The number of gold pieces this being possesses." + modifiable="false" + scope="character" + minimum="0" + player-info="money" /> + <attribute id="19" name="Capacity" + desc="The capacity of this character." + modifiable="false" + scope="character" + minimum="0" + maximum="255" + player-info="max-weight" > <modifier stacktype="stackable" modtype="additive" tag="cap1" effect="Capacity %+.2f" /> </attribute> <!-- End of core-attributes definition --> <!-- Temporary definitions for monsters until the auto-attack system is finished. --> - <attribute id="20" name="physical attack (minimum)" modifiable="false" scope="monster" /> - <attribute id="21" name="physical attack (delta)" modifiable="false" scope="monster" /> - <attribute id="22" name="magical attack" modifiable="false" scope="monster" /> + <attribute id="20" name="physical attack (minimum)" + modifiable="false" + scope="monster" + minimum="0" + maximum="255" /> + <attribute id="21" name="physical attack (delta)" + modifiable="false" + scope="monster" + minimum="0" + maximum="255" /> + <attribute id="22" name="magical attack" + modifiable="false" + scope="monster" + minimum="0" + maximum="255" /> </attributes> diff --git a/src/common/defines.h b/src/common/defines.h index ca59631..3c7d846 100644 --- a/src/common/defines.h +++ b/src/common/defines.h @@ -185,36 +185,4 @@ enum MOB_ATTR_MAG_ATK = 22 }; -/** - * Stackable types. - * @todo non-stackable malus layers - */ -enum StackableType -{ - Stackable, - NonStackable, - NonStackableBonus -}; - -/** - * Attribute augmentation methods. - */ -enum ModifierEffectType -{ - Multiplicative, - Additive -}; - -struct AttributeInfoType -{ - StackableType stackableType; - ModifierEffectType effectType; - - AttributeInfoType(StackableType s, - ModifierEffectType effect) : - stackableType(s), - effectType(effect) - {} -}; - #endif // DEFINES_H diff --git a/src/game-server/attribute.cpp b/src/game-server/attribute.cpp index 91113f4..82419e4 100644 --- a/src/game-server/attribute.cpp +++ b/src/game-server/attribute.cpp @@ -312,28 +312,34 @@ bool AttributeModifiersEffect::tick() return ret; } -Attribute::Attribute(const std::vector<struct AttributeInfoType> &type) - : mBase(0) +Attribute::Attribute(const AttributeManager::AttributeInfo &info): + mBase(0), + mMinValue(info.minimum), + mMaxValue(info.maximum) { - LOG_DEBUG("Construction of new attribute with '" << type.size() << "' layers."); - for (unsigned int i = 0; i < type.size(); ++i) + const std::vector<AttributeModifier> &modifiers = info.modifiers; + LOG_DEBUG("Construction of new attribute with '" << modifiers.size() + << "' layers."); + for (unsigned int i = 0; i < modifiers.size(); ++i) { - LOG_DEBUG("Adding layer with stackable type " << type[i].stackableType - << " and effect type " << type[i].effectType << "."); - mMods.push_back(new AttributeModifiersEffect(type[i].stackableType, - type[i].effectType)); + LOG_DEBUG("Adding layer with stackable type " + << modifiers[i].stackableType + << " and effect type " << modifiers[i].effectType << "."); + mMods.push_back(new AttributeModifiersEffect(modifiers[i].stackableType, + modifiers[i].effectType)); LOG_DEBUG("Layer added."); } + mBase = checkBounds(mBase); } Attribute::~Attribute() { - for (std::vector<AttributeModifiersEffect *>::iterator it = mMods.begin(), - it_end = mMods.end(); it != it_end; ++it) - { +// for (std::vector<AttributeModifiersEffect *>::iterator it = mMods.begin(), +// it_end = mMods.end(); it != it_end; ++it) +// { // ? //delete *it; - } +// } } bool Attribute::tick() @@ -365,8 +371,10 @@ void Attribute::clearMods() void Attribute::setBase(double base) { + base = checkBounds(base); LOG_DEBUG("Setting base attribute from " << mBase << " to " << base << "."); double prev = mBase = base; + std::vector<AttributeModifiersEffect *>::iterator it = mMods.begin(); while (it != mMods.end()) { @@ -383,3 +391,13 @@ void AttributeModifiersEffect::clearMods(double baseValue) mCacheVal = baseValue; mMod = mEffectType == Additive ? 0 : 1; } + +double Attribute::checkBounds(double baseValue) +{ + LOG_DEBUG("Checking bounds for value: " << baseValue); + if (baseValue > mMaxValue) + baseValue = mMaxValue; + else if (baseValue < mMinValue) + baseValue = mMinValue; + return baseValue; +} diff --git a/src/game-server/attribute.h b/src/game-server/attribute.h index cc7302d..046c8f6 100644 --- a/src/game-server/attribute.h +++ b/src/game-server/attribute.h @@ -22,6 +22,7 @@ #define ATTRIBUTE_H #include "common/defines.h" +#include "attributemanager.h" #include <vector> #include <list> @@ -133,12 +134,13 @@ class Attribute public: Attribute() {throw;} // DEBUG; Find improper constructions - Attribute(const std::vector<struct AttributeInfoType> &type); + Attribute(const AttributeManager::AttributeInfo &info); ~Attribute(); void setBase(double base); double getBase() const { return mBase; } + double getModifiedAttribute() const { return mMods.empty() ? mBase : (*mMods.rbegin())->getCachedModifiedValue(); } @@ -185,7 +187,15 @@ class Attribute bool tick(); private: - double mBase; + /** + * Checks the min and max permitted values for the given base value + * and return the adjusted value. + */ + double checkBounds(double baseValue); + + double mBase; // The attribute base value + double mMinValue; // The min authorized base and derived attribute value + double mMaxValue; // The max authorized base and derived attribute value std::vector<AttributeModifiersEffect *> mMods; }; diff --git a/src/game-server/attributemanager.cpp b/src/game-server/attributemanager.cpp index bb30784..d7a4214 100644 --- a/src/game-server/attributemanager.cpp +++ b/src/game-server/attributemanager.cpp @@ -49,9 +49,9 @@ void AttributeManager::reload() { unsigned int lCount = 0; LOG_DEBUG(" "<<i->first<<" : "); - for (std::vector<struct AttributeInfoType>::const_iterator j = i->second.second.begin(); - j != i->second.second.end(); - ++j) + for (std::vector<AttributeModifier>::const_iterator j = + i->second.modifiers.begin(); + j != i->second.modifiers.end(); ++j) { tag = getTag(ModifierLocation(i->first, lCount)); std::string end = tag ? "tag of '" + (*tag) + "'." : "no tag."; @@ -74,15 +74,15 @@ void AttributeManager::reload() LOG_INFO("Loaded '" << mTagMap.size() << "' modifier tags."); } -const std::vector<struct AttributeInfoType> *AttributeManager::getAttributeInfo(int id) const +const std::vector<AttributeModifier> *AttributeManager::getAttributeInfo(int id) const { AttributeMap::const_iterator ret = mAttributeMap.find(id); if (ret == mAttributeMap.end()) return 0; - return &ret->second.second; + return &ret->second.modifiers; } -const AttributeScope &AttributeManager::getAttributeScope(ScopeType type) const +const AttributeManager::AttributeScope &AttributeManager::getAttributeScope(ScopeType type) const { return mAttributeScopes[type]; } @@ -92,7 +92,7 @@ bool AttributeManager::isAttributeDirectlyModifiable(int id) const AttributeMap::const_iterator ret = mAttributeMap.find(id); if (ret == mAttributeMap.end()) return false; - return ret->second.first; + return ret->second.modifiable; } ModifierLocation AttributeManager::getLocation(const std::string &tag) const @@ -144,8 +144,12 @@ void AttributeManager::readAttributeNode(xmlNodePtr attributeNode) return; } - mAttributeMap[id] = - AttributeInfoMap(false, std::vector<struct AttributeInfoType>()); + mAttributeMap[id].modifiable = false; + 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()); for_each_xml_child_node(subNode, attributeNode) { @@ -166,19 +170,22 @@ void AttributeManager::readAttributeNode(xmlNodePtr attributeNode) } else if (scope == "CHARACTER") { - mAttributeScopes[CharacterScope][id] = &mAttributeMap.at(id).second; + mAttributeScopes[CharacterScope][id] = + &mAttributeMap.at(id); LOG_DEBUG("Attribute manager: attribute '" << id << "' added to default character scope."); } else if (scope == "MONSTER") { - mAttributeScopes[MonsterScope][id] = &mAttributeMap.at(id).second; + mAttributeScopes[MonsterScope][id] = + &mAttributeMap.at(id); LOG_DEBUG("Attribute manager: attribute '" << id << "' added to default monster scope."); } else if (scope == "BEING") { - mAttributeScopes[BeingScope][id] = &mAttributeMap.at(id).second; + mAttributeScopes[BeingScope][id] = + &mAttributeMap.at(id); LOG_DEBUG("Attribute manager: attribute '" << id << "' added to default being scope."); } @@ -242,12 +249,13 @@ void AttributeManager::readModifierNode(xmlNodePtr modifierNode, return; } - mAttributeMap[attributeId].second.push_back( - AttributeInfoType(stackableType, effectType)); + mAttributeMap[attributeId].modifiers.push_back( + AttributeModifier(stackableType, effectType)); if (!tag.empty()) { - const int layer = mAttributeMap[attributeId].second.size() - 1; + const int layer = + mAttributeMap[attributeId].modifiers.size() - 1; mTagMap.insert(std::make_pair(tag, ModifierLocation(attributeId, layer))); } diff --git a/src/game-server/attributemanager.h b/src/game-server/attributemanager.h index c4843c3..63ebf64 100644 --- a/src/game-server/attributemanager.h +++ b/src/game-server/attributemanager.h @@ -24,6 +24,7 @@ #include <map> #include <vector> #include <string> +#include <limits> #include "utils/xml.h" @@ -36,7 +37,36 @@ enum ScopeType MaxScope }; -typedef std::map<int, std::vector<struct AttributeInfoType> *> AttributeScope; +/** + * Stackable types. + * @todo non-stackable malus layers + */ +enum StackableType +{ + Stackable, + NonStackable, + NonStackableBonus +}; + +/** + * Attribute augmentation methods. + */ +enum ModifierEffectType +{ + Multiplicative, + Additive +}; + +struct AttributeModifier +{ + AttributeModifier(StackableType s, ModifierEffectType effect) : + stackableType(s), + effectType(effect) + {} + + StackableType stackableType; + ModifierEffectType effectType; +}; /** * Identifies a modifier by the attribute id that it applies to and its layer @@ -59,6 +89,22 @@ struct ModifierLocation class AttributeManager { public: + struct AttributeInfo { + AttributeInfo(): + minimum(std::numeric_limits<double>::min()), + maximum(std::numeric_limits<double>::max()), + modifiable(false) + {} + + /** The minimum and maximum permitted attribute values. */ + double minimum; + double maximum; + /** Tells whether the base attribute is modifiable by the player */ + bool modifiable; + /** Effect modifier type: stackability and modification type. */ + std::vector<struct AttributeModifier> modifiers; + }; + AttributeManager(const std::string &file) : mAttributeReferenceFile(file) {} @@ -73,7 +119,10 @@ class AttributeManager */ void reload(); - const std::vector<struct AttributeInfoType> *getAttributeInfo(int id) const; + const std::vector<AttributeModifier> *getAttributeInfo(int id) const; + + // being type id -> (*{ stackable type, effect type })[] + typedef std::map<int, AttributeInfo*> AttributeScope; const AttributeScope &getAttributeScope(ScopeType) const; @@ -88,17 +137,12 @@ class AttributeManager void readAttributeNode(xmlNodePtr attributeNode); void readModifierNode(xmlNodePtr modifierNode, int attributeId); - // modifiable, { stackable type, effect type }[] - typedef std::pair<bool, - std::vector<struct AttributeInfoType> > AttributeInfoMap; - - // Attribute id -> { modifiable, { stackable type, effect type }[] } - typedef std::map<int, AttributeInfoMap> AttributeMap; + // Attribute id -> { modifiable, min, max, { stackable type, effect type }[] } + typedef std::map<int, AttributeInfo> AttributeMap; /** Maps tag names to specific modifiers. */ typedef std::map<std::string, ModifierLocation> TagMap; - // being type id -> (*{ stackable type, effect type })[] AttributeScope mAttributeScopes[MaxScope]; AttributeMap mAttributeMap; TagMap mTagMap; diff --git a/src/game-server/being.cpp b/src/game-server/being.cpp index 8208045..d44d2a6 100644 --- a/src/game-server/being.cpp +++ b/src/game-server/being.cpp @@ -42,9 +42,9 @@ Being::Being(ThingType type): mGender(GENDER_UNSPECIFIED), mDirection(DOWN) { - const AttributeScope &attr = attributeManager->getAttributeScope(BeingScope); + const AttributeManager::AttributeScope &attr = attributeManager->getAttributeScope(BeingScope); LOG_DEBUG("Being creation: initialisation of " << attr.size() << " attributes."); - for (AttributeScope::const_iterator it1 = attr.begin(), + for (AttributeManager::AttributeScope::const_iterator it1 = attr.begin(), it1_end = attr.end(); it1 != it1_end; ++it1) diff --git a/src/game-server/character.cpp b/src/game-server/character.cpp index 70dd344..66fbd16 100644 --- a/src/game-server/character.cpp +++ b/src/game-server/character.cpp @@ -69,11 +69,11 @@ Character::Character(MessageIn &msg): mParty(0), mTransaction(TRANS_NONE) { - const AttributeScope &attr = + const AttributeManager::AttributeScope &attr = attributeManager->getAttributeScope(CharacterScope); LOG_DEBUG("Character creation: initialisation of " << attr.size() << " attributes."); - for (AttributeScope::const_iterator it1 = attr.begin(), + for (AttributeManager::AttributeScope::const_iterator it1 = attr.begin(), it1_end = attr.end(); it1 != it1_end; ++it1) mAttributes.insert(std::make_pair(it1->first, Attribute(*it1->second))); @@ -396,7 +396,7 @@ bool Character::recalculateBaseAttribute(unsigned int attr) /* * `attr' may or may not have changed. Recalculate the base value. */ - LOG_DEBUG("Received update attribute recalculation request at Character" + LOG_DEBUG("Received update attribute recalculation request at Character " "for " << attr << "."); if (!mAttributes.count(attr)) return false; diff --git a/src/game-server/monster.cpp b/src/game-server/monster.cpp index f721868..6e40fb2 100644 --- a/src/game-server/monster.cpp +++ b/src/game-server/monster.cpp @@ -59,10 +59,10 @@ Monster::Monster(MonsterClass *specy): /* * Initialise the attribute structures. */ - const AttributeScope &mobAttr = attributeManager->getAttributeScope( - MonsterScope); + const AttributeManager::AttributeScope &mobAttr = + attributeManager->getAttributeScope(MonsterScope); - for (AttributeScope::const_iterator it = mobAttr.begin(), + for (AttributeManager::AttributeScope::const_iterator it = mobAttr.begin(), it_end = mobAttr.end(); it != it_end; ++it) { mAttributes.insert(std::pair< unsigned int, Attribute > diff --git a/src/game-server/monstermanager.cpp b/src/game-server/monstermanager.cpp index 313be34..bebb74a 100644 --- a/src/game-server/monstermanager.cpp +++ b/src/game-server/monstermanager.cpp @@ -169,11 +169,11 @@ void MonsterManager::initialize() } bool attributesComplete = true; - const AttributeScope &mobAttr = + const AttributeManager::AttributeScope &mobAttr = attributeManager->getAttributeScope(MonsterScope); - for (AttributeScope::const_iterator it = mobAttr.begin(), - it_end = mobAttr.end(); it != it_end; ++it) + for (AttributeManager::AttributeScope::const_iterator it = + mobAttr.begin(), it_end = mobAttr.end(); it != it_end; ++it) { if (!monster->mAttributes.count(it->first)) { |