From fbcc334baf71ca8735adb66c837f6bb610cba758 Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Sat, 19 Mar 2011 12:30:19 +0100 Subject: Renaming stuff to make the code more readable SCOPE_TYPES -> ScopeType (plural was confusing) ATTR_BEING -> BeingScope ATTR_CHAR -> CharacterScope ATTR_MOD -> MonsterScope ATTR_MAX -> MaxScope AttributeScopes -> AttributeScope (A single scope seems to include multiple lists of attributes. Seems wrong to me to name this type in plural form.) getAttributeInfoForType -> getAttributeScope (just naming it after what it is actually returning) Reviewed-by: Freeyorp --- src/game-server/attributemanager.h | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'src/game-server/attributemanager.h') diff --git a/src/game-server/attributemanager.h b/src/game-server/attributemanager.h index a87ba901..7e05c914 100644 --- a/src/game-server/attributemanager.h +++ b/src/game-server/attributemanager.h @@ -25,22 +25,24 @@ #include #include -typedef struct AttributeInfoType AttributeInfoType_t; - -enum SCOPE_TYPES { - ATTR_BEING = 0, - ATTR_CHAR, - ATTR_MOB, +enum ScopeType +{ + BeingScope = 0, + CharacterScope, + MonsterScope, // Add new types here as needed - ATTR_MAX + MaxScope }; -typedef std::map< int, std::vector * > AttributeScopes; +typedef std::map< int, std::vector * > AttributeScope; class AttributeManager { public: - AttributeManager(const std::string &file) : mAttributeReferenceFile(file) {} + AttributeManager(const std::string &file) : + mAttributeReferenceFile(file) + {} + /** * Loads attribute reference file. */ @@ -50,15 +52,17 @@ class AttributeManager * Reloads attribute reference file. */ void reload(); + const std::vector *getAttributeInfo(unsigned int) const; - const AttributeScopes &getAttributeInfoForType(SCOPE_TYPES) const; + const AttributeScope &getAttributeScope(ScopeType) const; bool isAttributeDirectlyModifiable(unsigned int) const; std::pair getInfoFromTag(const std::string &) const; const std::string *getTagFromInfo(unsigned int, unsigned int) const; + private: // modifiable, { stackable type, effect type }[] typedef std::pair< bool, @@ -71,7 +75,7 @@ class AttributeManager std::pair > TagMap; // being type id -> (*{ stackable type, effect type })[] - AttributeScopes mAttributeScopes[ATTR_MAX]; + AttributeScope mAttributeScopes[MaxScope]; AttributeMap mAttributeMap; TagMap mTagMap; -- cgit v1.2.3-60-g2f50