From 12a8d0a76439f0e5a0c548fbe2752fcb144b10be Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 29 Jun 2016 20:45:25 +0300 Subject: Move basic skill definition fro net into statdb. --- src/net/eathena/generalhandler.cpp | 19 ------------------- src/net/tmwa/generalhandler.cpp | 19 ------------------- src/resources/db/statdb.cpp | 23 +++++++++++++++++++---- src/resources/db/statdb.h | 2 +- 4 files changed, 20 insertions(+), 43 deletions(-) (limited to 'src') diff --git a/src/net/eathena/generalhandler.cpp b/src/net/eathena/generalhandler.cpp index 42a5ad974..fb78e800f 100644 --- a/src/net/eathena/generalhandler.cpp +++ b/src/net/eathena/generalhandler.cpp @@ -68,9 +68,6 @@ #include "net/eathena/questhandler.h" #include "net/eathena/vendinghandler.h" -#include "resources/db/itemdbstat.h" -#include "resources/db/statdb.h" - #include "utils/delete2.h" #include "utils/gettext.h" @@ -118,22 +115,6 @@ GeneralHandler::GeneralHandler() : mSearchStoreHandler(new SearchStoreHandler) { generalHandler = this; - - std::vector stats; - // TRANSLATORS: player stat - stats.push_back(ItemDB::Stat("str", _("Strength %s"))); - // TRANSLATORS: player stat - stats.push_back(ItemDB::Stat("agi", _("Agility %s"))); - // TRANSLATORS: player stat - stats.push_back(ItemDB::Stat("vit", _("Vitality %s"))); - // TRANSLATORS: player stat - stats.push_back(ItemDB::Stat("int", _("Intelligence %s"))); - // TRANSLATORS: player stat - stats.push_back(ItemDB::Stat("dex", _("Dexterity %s"))); - // TRANSLATORS: player stat - stats.push_back(ItemDB::Stat("luck", _("Luck %s"))); - - StatDb::setStatsList(stats); } GeneralHandler::~GeneralHandler() diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp index 4fef79f57..390c2d021 100644 --- a/src/net/tmwa/generalhandler.cpp +++ b/src/net/tmwa/generalhandler.cpp @@ -71,9 +71,6 @@ #include "net/tmwa/vendinghandler.h" #endif -#include "resources/db/itemdbstat.h" -#include "resources/db/statdb.h" - #include "utils/delete2.h" #include "utils/gettext.h" @@ -125,22 +122,6 @@ GeneralHandler::GeneralHandler() : #endif { generalHandler = this; - - std::vector stats; - // TRANSLATORS: player stat - stats.push_back(ItemDB::Stat("str", _("Strength %s"))); - // TRANSLATORS: player stat - stats.push_back(ItemDB::Stat("agi", _("Agility %s"))); - // TRANSLATORS: player stat - stats.push_back(ItemDB::Stat("vit", _("Vitality %s"))); - // TRANSLATORS: player stat - stats.push_back(ItemDB::Stat("int", _("Intelligence %s"))); - // TRANSLATORS: player stat - stats.push_back(ItemDB::Stat("dex", _("Dexterity %s"))); - // TRANSLATORS: player stat - stats.push_back(ItemDB::Stat("luck", _("Luck %s"))); - - StatDb::setStatsList(stats); } GeneralHandler::~GeneralHandler() diff --git a/src/resources/db/statdb.cpp b/src/resources/db/statdb.cpp index 2fc2d592c..41c4b6c44 100644 --- a/src/resources/db/statdb.cpp +++ b/src/resources/db/statdb.cpp @@ -29,22 +29,35 @@ #include "resources/item/itemfieldtype.h" +#include "utils/gettext.h" + #include "debug.h" namespace { bool mLoaded = false; - static std::vector extraStats; + static std::vector mBasicStats; } // namespace -void StatDb::setStatsList(const std::vector &stats) +void StatDb::addBasicStats() { - extraStats = stats; + // TRANSLATORS: player stat + mBasicStats.push_back(ItemDB::Stat("str", _("Strength %s"))); + // TRANSLATORS: player stat + mBasicStats.push_back(ItemDB::Stat("agi", _("Agility %s"))); + // TRANSLATORS: player stat + mBasicStats.push_back(ItemDB::Stat("vit", _("Vitality %s"))); + // TRANSLATORS: player stat + mBasicStats.push_back(ItemDB::Stat("int", _("Intelligence %s"))); + // TRANSLATORS: player stat + mBasicStats.push_back(ItemDB::Stat("dex", _("Dexterity %s"))); + // TRANSLATORS: player stat + mBasicStats.push_back(ItemDB::Stat("luck", _("Luck %s"))); } const std::vector &StatDb::getExtraStats() { - return extraStats; + return mBasicStats; } void StatDb::load() @@ -54,6 +67,8 @@ void StatDb::load() logger->log1("Initializing stat database..."); + addBasicStats(); + loadXmlFile(paths.getStringValue("statFile"), SkipError_false); loadXmlFile(paths.getStringValue("statPatchFile"), SkipError_true); loadXmlDir("statPatchDir", loadXmlFile); diff --git a/src/resources/db/statdb.h b/src/resources/db/statdb.h index 860235439..247c50ddb 100644 --- a/src/resources/db/statdb.h +++ b/src/resources/db/statdb.h @@ -39,7 +39,7 @@ namespace StatDb void loadXmlFile(const std::string &fileName, const SkipError skipError); - void setStatsList(const std::vector &stats); + void addBasicStats(); const std::vector &getExtraStats(); } // namespace StatDb -- cgit v1.2.3-70-g09d2