From 758d80263b1647c712c0e0cdd3dfca9945a1bb7e Mon Sep 17 00:00:00 2001 From: Yohann Ferreira Date: Sat, 18 Sep 2010 15:17:39 +0200 Subject: Fixed attribute built-ins display at character's creation. Reviewed-by: Thorbjorn. Resolves: Mana-Mantis #229. --- src/net/manaserv/attributes.cpp | 31 +++++++++++++++++++++---------- 1 file 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(); -- cgit v1.2.3-70-g09d2