diff options
Diffstat (limited to 'src/resources')
-rw-r--r-- | src/resources/db/statdb.cpp | 16 | ||||
-rw-r--r-- | src/resources/db/statdb.h | 4 |
2 files changed, 15 insertions, 5 deletions
diff --git a/src/resources/db/statdb.cpp b/src/resources/db/statdb.cpp index b68ee9576..0e7175310 100644 --- a/src/resources/db/statdb.cpp +++ b/src/resources/db/statdb.cpp @@ -35,6 +35,7 @@ namespace bool mLoaded = false; static std::vector<BasicStat> mBasicStats; static std::map<std::string, std::vector<BasicStat> > mStats; + static std::vector<std::string> mPages; } // namespace void StatDb::addDefaultStats() @@ -70,9 +71,14 @@ const std::vector<BasicStat> &StatDb::getBasicStats() return mBasicStats; } -const std::vector<BasicStat> &StatDb::getExtendedStats() +const std::vector<BasicStat> &StatDb::getStats(const std::string &page) { - return mStats["extended"]; + return mStats[page]; +} + +const std::vector<std::string> &StatDb::getPages() +{ + return mPages; } void StatDb::load() @@ -116,6 +122,7 @@ static void loadStats(const XmlNodePtr rootNode, { const int maxAttr = static_cast<int>(Attributes::MAX_ATTRIBUTE); std::vector<BasicStat> &stats = mStats[page]; + mPages.push_back(page); for_each_xml_child_node(node, rootNode) { if (xmlNameEqual(node, "stat")) @@ -167,11 +174,12 @@ void StatDb::loadXmlFile(const std::string &fileName, } else if (xmlNameEqual(node, "extended")) { - loadStats(node, "extended"); + // TRANSLATORS: stats page name + loadStats(node, _("Extended")); } else if (xmlNameEqual(node, "page")) { - std::string page = XML::getProperty(node, "name", ""); + std::string page = XML::langProperty(node, "name", ""); if (page.empty()) { reportAlways("Page without name in stats.xml"); diff --git a/src/resources/db/statdb.h b/src/resources/db/statdb.h index 96392d06f..f98eac111 100644 --- a/src/resources/db/statdb.h +++ b/src/resources/db/statdb.h @@ -42,7 +42,9 @@ namespace StatDb const std::vector<BasicStat> &getBasicStats(); - const std::vector<BasicStat> &getExtendedStats(); + const std::vector<BasicStat> &getStats(const std::string &page); + + const std::vector<std::string> &getPages(); } // namespace StatDb #endif // RESOURCES_DB_STATDB_H |