From 311c175f3184103950c72bc5c775174597430b83 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 14 Jul 2017 01:31:22 +0300 Subject: Replace std::vector into macro STD_VECTOR. In most case it equal to std::vector except debug modes. Now it can be also mse::mstd::vector, but sadly this class not support all required features. --- src/resources/db/chardb.cpp | 4 ++-- src/resources/db/chardb.h | 2 +- src/resources/db/deaddb.cpp | 2 +- src/resources/db/itemdb.cpp | 4 ++-- src/resources/db/itemdb.h | 2 +- src/resources/db/itemoptiondb.cpp | 10 +++++----- src/resources/db/itemoptiondb.h | 4 ++-- src/resources/db/networkdb.h | 2 +- src/resources/db/questdb.cpp | 18 +++++++++--------- src/resources/db/questdb.h | 4 ++-- src/resources/db/sounddb.cpp | 2 +- src/resources/db/statdb.cpp | 14 +++++++------- src/resources/db/statdb.h | 6 +++--- src/resources/db/unitsdb.cpp | 2 +- src/resources/db/weaponsdb.h | 2 +- 15 files changed, 39 insertions(+), 39 deletions(-) (limited to 'src/resources/db') diff --git a/src/resources/db/chardb.cpp b/src/resources/db/chardb.cpp index fe87ea157..915c3444b 100644 --- a/src/resources/db/chardb.cpp +++ b/src/resources/db/chardb.cpp @@ -40,7 +40,7 @@ namespace unsigned mMaxLook = 0; unsigned mMinRace = 0; unsigned mMaxRace = 30; - std::vector mDefaultItems; + STD_VECTOR mDefaultItems; } // namespace void CharDB::load() @@ -181,7 +181,7 @@ unsigned CharDB::getMaxRace() return mMaxRace; } -const std::vector &CharDB::getDefaultItems() +const STD_VECTOR &CharDB::getDefaultItems() { return mDefaultItems; } diff --git a/src/resources/db/chardb.h b/src/resources/db/chardb.h index 083e7c12d..f940d3059 100644 --- a/src/resources/db/chardb.h +++ b/src/resources/db/chardb.h @@ -69,7 +69,7 @@ namespace CharDB unsigned getMaxRace() A_WARN_UNUSED; - const std::vector &getDefaultItems() A_WARN_UNUSED; + const STD_VECTOR &getDefaultItems() A_WARN_UNUSED; } // namespace CharDB #endif // RESOURCES_DB_CHARDB_H diff --git a/src/resources/db/deaddb.cpp b/src/resources/db/deaddb.cpp index bcca023eb..8c273e239 100644 --- a/src/resources/db/deaddb.cpp +++ b/src/resources/db/deaddb.cpp @@ -32,7 +32,7 @@ namespace { bool mLoaded = false; - std::vector mMessages; + STD_VECTOR mMessages; } // namespace void DeadDB::load() diff --git a/src/resources/db/itemdb.cpp b/src/resources/db/itemdb.cpp index 57000cf95..e23623367 100644 --- a/src/resources/db/itemdb.cpp +++ b/src/resources/db/itemdb.cpp @@ -1050,10 +1050,10 @@ static void loadOrderSprite(ItemInfo *const itemInfo, itemInfo->setDrawPriority(direction, priority); } -std::string ItemDB::getNamesStr(const std::vector &parts) +std::string ItemDB::getNamesStr(const STD_VECTOR &parts) { std::string str; - FOR_EACH (std::vector::const_iterator, it, parts) + FOR_EACH (STD_VECTOR::const_iterator, it, parts) { const int id = *it; if (exists(id)) diff --git a/src/resources/db/itemdb.h b/src/resources/db/itemdb.h index 34421d84b..96de60b6a 100644 --- a/src/resources/db/itemdb.h +++ b/src/resources/db/itemdb.h @@ -63,7 +63,7 @@ namespace ItemDB const ItemDB::ItemInfos &getItemInfos(); - std::string getNamesStr(const std::vector &parts); + std::string getNamesStr(const STD_VECTOR &parts); #ifdef UNITTESTS ItemDB::NamedItemInfos &getNamedItemInfosTest(); diff --git a/src/resources/db/itemoptiondb.cpp b/src/resources/db/itemoptiondb.cpp index bd78f95c5..2f7fc1ccd 100644 --- a/src/resources/db/itemoptiondb.cpp +++ b/src/resources/db/itemoptiondb.cpp @@ -33,7 +33,7 @@ namespace { ItemOptionDb::OptionInfos mOptions; - const std::vector mEmptyOption; + const STD_VECTOR mEmptyOption; bool mLoaded = false; } // namespace @@ -48,7 +48,7 @@ void ItemOptionDb::load() mLoaded = true; } -static void addFieldByName(std::vector &options, +static void addFieldByName(STD_VECTOR &options, XmlNodeConstPtr node, const ItemFieldDb::FieldInfos &fields, const char *const name) @@ -68,7 +68,7 @@ static void addFieldByName(std::vector &options, } } -static void readOptionFields(std::vector &options, +static void readOptionFields(STD_VECTOR &options, XmlNodeConstPtr node, const ItemFieldDb::FieldInfos &fields) { @@ -127,7 +127,7 @@ void ItemOptionDb::loadXmlFile(const std::string &fileName, reportAlways("Empty id field in ItemOptionDb"); continue; } - std::vector &options = mOptions[id]; + STD_VECTOR &options = mOptions[id]; readOptionFields(options, node, requiredFields); readOptionFields(options, node, addFields); } @@ -140,7 +140,7 @@ void ItemOptionDb::unload() mLoaded = false; } -const std::vector &ItemOptionDb::getFields(const int id) +const STD_VECTOR &ItemOptionDb::getFields(const int id) { OptionInfos::const_iterator it = mOptions.find(id); if (it == mOptions.end()) diff --git a/src/resources/db/itemoptiondb.h b/src/resources/db/itemoptiondb.h index a4fb82638..8d9bc9968 100644 --- a/src/resources/db/itemoptiondb.h +++ b/src/resources/db/itemoptiondb.h @@ -41,9 +41,9 @@ namespace ItemOptionDb void loadXmlFile(const std::string &fileName, const SkipError skipError); - const std::vector &getFields(const int id); + const STD_VECTOR &getFields(const int id); - typedef std::map > OptionInfos; + typedef std::map > OptionInfos; } // namespace ItemOptionDb #endif // RESOURCES_DB_ITEMOPTIONDB_H diff --git a/src/resources/db/networkdb.h b/src/resources/db/networkdb.h index 697adbc44..0541f9c1f 100644 --- a/src/resources/db/networkdb.h +++ b/src/resources/db/networkdb.h @@ -30,7 +30,7 @@ typedef std::map NetworkInPacketInfos; typedef NetworkInPacketInfos::const_iterator NetworkInPacketInfosIter; -typedef std::vector NetworkRemovePacketInfos; +typedef STD_VECTOR NetworkRemovePacketInfos; typedef NetworkRemovePacketInfos::const_iterator NetworkRemovePacketInfosIter; namespace NetworkDb diff --git a/src/resources/db/questdb.cpp b/src/resources/db/questdb.cpp index 6ac2c7f34..44c59226c 100644 --- a/src/resources/db/questdb.cpp +++ b/src/resources/db/questdb.cpp @@ -39,8 +39,8 @@ namespace // quest variables: var, (val1, val2, val3, time) NpcQuestVarMap mVars; // quests: var, quests - std::map > mQuests; - std::vector mAllEffects; + std::map > mQuests; + STD_VECTOR mAllEffects; } // namespace void QuestDb::load() @@ -213,11 +213,11 @@ void QuestDb::loadXmlFile(const std::string &fileName, void QuestDb::unload() { - for (std::map >::iterator it + for (std::map >::iterator it = mQuests.begin(), it_end = mQuests.end(); it != it_end; ++ it) { - std::vector &quests = (*it).second; - for (std::vector::iterator it2 = quests.begin(), + STD_VECTOR &quests = (*it).second; + for (STD_VECTOR::iterator it2 = quests.begin(), it2_end = quests.end(); it2 != it2_end; ++ it2) { delete *it2; @@ -233,26 +233,26 @@ NpcQuestVarMap *QuestDb::getVars() return &mVars; } -std::map > *QuestDb::getQuests() +std::map > *QuestDb::getQuests() { return &mQuests; } -std::vector *QuestDb::getAllEffects() +STD_VECTOR *QuestDb::getAllEffects() { return &mAllEffects; } std::string QuestDb::getName(const int id) { - std::map >::const_iterator it = + std::map >::const_iterator it = mQuests.find(id); if (it == mQuests.end()) { // TRANSLATORS: quests window quest name return _("unknown"); } - const std::vector &items = (*it).second; + const STD_VECTOR &items = (*it).second; if (items.empty()) { // TRANSLATORS: quests window quest name diff --git a/src/resources/db/questdb.h b/src/resources/db/questdb.h index 1bec2cc4e..865f917fe 100644 --- a/src/resources/db/questdb.h +++ b/src/resources/db/questdb.h @@ -45,9 +45,9 @@ namespace QuestDb NpcQuestVarMap *getVars(); - std::map > *getQuests(); + std::map > *getQuests(); - std::vector *getAllEffects(); + STD_VECTOR *getAllEffects(); std::string getName(const int id); } // namespace QuestDb diff --git a/src/resources/db/sounddb.cpp b/src/resources/db/sounddb.cpp index 0907f5cdc..90dc9fe00 100644 --- a/src/resources/db/sounddb.cpp +++ b/src/resources/db/sounddb.cpp @@ -32,7 +32,7 @@ namespace { std::string mDefault; - std::vector mSounds; + STD_VECTOR mSounds; } // namespace void SoundDB::load() diff --git a/src/resources/db/statdb.cpp b/src/resources/db/statdb.cpp index 26734bdb3..08fef09d6 100644 --- a/src/resources/db/statdb.cpp +++ b/src/resources/db/statdb.cpp @@ -35,9 +35,9 @@ namespace { bool mLoaded = false; - std::vector mBasicStats; - std::map > mStats; - std::vector mPages; + STD_VECTOR mBasicStats; + std::map > mStats; + STD_VECTOR mPages; } // namespace void StatDb::addDefaultStats() @@ -68,17 +68,17 @@ void StatDb::addDefaultStats() _("Luck"))); } -const std::vector &StatDb::getBasicStats() +const STD_VECTOR &StatDb::getBasicStats() { return mBasicStats; } -const std::vector &StatDb::getStats(const std::string &page) +const STD_VECTOR &StatDb::getStats(const std::string &page) { return mStats[page]; } -const std::vector &StatDb::getPages() +const STD_VECTOR &StatDb::getPages() { return mPages; } @@ -135,7 +135,7 @@ static void loadStats(XmlNodeConstPtr rootNode, const std::string &page) { const int maxAttr = static_cast(Attributes::MAX_ATTRIBUTE); - std::vector &stats = mStats[page]; + STD_VECTOR &stats = mStats[page]; mPages.push_back(page); for_each_xml_child_node(node, rootNode) { diff --git a/src/resources/db/statdb.h b/src/resources/db/statdb.h index 898f0af63..73b24894b 100644 --- a/src/resources/db/statdb.h +++ b/src/resources/db/statdb.h @@ -40,11 +40,11 @@ namespace StatDb void addDefaultStats(); - const std::vector &getBasicStats(); + const STD_VECTOR &getBasicStats(); - const std::vector &getStats(const std::string &page); + const STD_VECTOR &getStats(const std::string &page); - const std::vector &getPages(); + const STD_VECTOR &getPages(); } // namespace StatDb #endif // RESOURCES_DB_STATDB_H diff --git a/src/resources/db/unitsdb.cpp b/src/resources/db/unitsdb.cpp index 998dd7230..bf498411b 100644 --- a/src/resources/db/unitsdb.cpp +++ b/src/resources/db/unitsdb.cpp @@ -52,7 +52,7 @@ namespace { A_DEFAULT_COPY(UnitDescription) - std::vector levels; + STD_VECTOR levels; double conversion; bool mix; }; diff --git a/src/resources/db/weaponsdb.h b/src/resources/db/weaponsdb.h index e30b4f544..a957347bc 100644 --- a/src/resources/db/weaponsdb.h +++ b/src/resources/db/weaponsdb.h @@ -25,7 +25,7 @@ #include "localconsts.h" -typedef std::vector WeaponsInfos; +typedef STD_VECTOR WeaponsInfos; typedef WeaponsInfos::const_iterator WeaponsInfosIter; namespace WeaponsDB -- cgit v1.2.3-70-g09d2