diff options
-rw-r--r-- | src/net/manaserv/attributes.cpp | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/src/net/manaserv/attributes.cpp b/src/net/manaserv/attributes.cpp index 7a9a761a..67c52788 100644 --- a/src/net/manaserv/attributes.cpp +++ b/src/net/manaserv/attributes.cpp @@ -40,7 +40,9 @@ namespace ManaServ { namespace Attributes { - typedef struct { + + typedef struct + { unsigned int id; std::string name; std::string description; @@ -82,6 +84,22 @@ namespace Attributes { return attributeLabels; } + /** + * Fills the list of base attribute labels. + */ + static void fillLabels() + { + // Fill up the modifiable attribute label list. + attributeLabels.clear(); + AttributeMap::const_iterator it, it_end; + for (it = attributes.begin(), it_end = attributes.end(); it != it_end; + it++) + { + if (it->second.modifiable) + attributeLabels.push_back(it->second.name + ":"); + } + } + static void loadBuiltins() { { @@ -163,6 +181,7 @@ namespace Attributes { logger->log("Attributes: Error while loading " DEFAULT_ATTRIBUTESDB_FILE ". Using Built-ins."); loadBuiltins(); + fillLabels(); return; } @@ -261,15 +280,7 @@ namespace Attributes { logger->log("Found %d tags for %d attributes.", int(tags.size()), int(attributes.size())); - // Fill up the modifiable attribute label list. - attributeLabels.clear(); - AttributeMap::const_iterator it, it_end; - for (it = attributes.begin(), it_end = attributes.end(); it != it_end; - it++) - { - if (it->second.modifiable) - attributeLabels.push_back(it->second.name + ":"); - } + fillLabels(); // Sanity checks on starting points float modifiableAttributeCount = (float) attributeLabels.size(); |