diff options
author | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2010-09-18 15:17:39 +0200 |
---|---|---|
committer | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2010-09-18 15:17:39 +0200 |
commit | 758d80263b1647c712c0e0cdd3dfca9945a1bb7e (patch) | |
tree | 2f3e84f4dc6e2f90d8754a95f935498ad608090f | |
parent | 2781bcfc1f85da513633f20000cfe66931948636 (diff) | |
download | mana-758d80263b1647c712c0e0cdd3dfca9945a1bb7e.tar.gz mana-758d80263b1647c712c0e0cdd3dfca9945a1bb7e.tar.bz2 mana-758d80263b1647c712c0e0cdd3dfca9945a1bb7e.tar.xz mana-758d80263b1647c712c0e0cdd3dfca9945a1bb7e.zip |
Fixed attribute built-ins display at character's creation.
Reviewed-by: Thorbjorn.
Resolves: Mana-Mantis #229.
-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(); |