diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-08-03 22:43:54 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-08-04 00:57:58 +0300 |
commit | de73e67e830c15e6b623ba03eda88f9faacac40c (patch) | |
tree | 79422e9c944b751cd0c0b8ad6fd37e32ddaaa130 /src/resources | |
parent | 653f89fa3b236103670796af4b76a23e8ae84248 (diff) | |
download | manaverse-de73e67e830c15e6b623ba03eda88f9faacac40c.tar.gz manaverse-de73e67e830c15e6b623ba03eda88f9faacac40c.tar.bz2 manaverse-de73e67e830c15e6b623ba03eda88f9faacac40c.tar.xz manaverse-de73e67e830c15e6b623ba03eda88f9faacac40c.zip |
Add missing load / unload databases logging.
Diffstat (limited to 'src/resources')
31 files changed, 73 insertions, 11 deletions
diff --git a/src/resources/db/avatardb.cpp b/src/resources/db/avatardb.cpp index a3abf5fec..4e2fb821d 100644 --- a/src/resources/db/avatardb.cpp +++ b/src/resources/db/avatardb.cpp @@ -46,6 +46,8 @@ void AvatarDB::load() { if (mLoaded) unload(); + + logger->log1("Initializing avatar database..."); loadXmlFile(paths.getStringValue("avatarsFile"), SkipError_false); loadXmlFile(paths.getStringValue("avatarsPatchFile"), SkipError_true); loadXmlDir("avatarsPatchDir", loadXmlFile); @@ -129,6 +131,7 @@ void AvatarDB::loadXmlFile(const std::string &fileName, void AvatarDB::unload() { + logger->log1("Unloading avatar database..."); delete_all(mAvatarInfos); mAvatarInfos.clear(); mLoaded = false; diff --git a/src/resources/db/badgesdb.cpp b/src/resources/db/badgesdb.cpp index 873149f41..1d41ba1e5 100644 --- a/src/resources/db/badgesdb.cpp +++ b/src/resources/db/badgesdb.cpp @@ -21,6 +21,7 @@ #include "resources/db/badgesdb.h" #include "configuration.h" +#include "logger.h" #include "fs/virtfs/tools.h" @@ -73,6 +74,7 @@ void BadgesDB::load() if (mLoaded) unload(); + logger->log1("Initializing Badges database..."); loadDB("guild", mGuilds); loadDB("name", mNames); loadDB("party", mParties); @@ -80,6 +82,7 @@ void BadgesDB::load() void BadgesDB::unload() { + logger->log1("Unloading Badges database..."); mParties.clear(); mGuilds.clear(); mNames.clear(); diff --git a/src/resources/db/chardb.cpp b/src/resources/db/chardb.cpp index 915c3444b..2dd60270b 100644 --- a/src/resources/db/chardb.cpp +++ b/src/resources/db/chardb.cpp @@ -48,6 +48,8 @@ void CharDB::load() if (mLoaded) unload(); + logger->log1("Initializing char database..."); + XML::Document *doc = new XML::Document( paths.getStringValue("charCreationFile"), UseVirtFs_true, @@ -121,7 +123,7 @@ void CharDB::loadMinMax(XmlNodeConstPtr node, void CharDB::unload() { - logger->log1("Unloading chars database..."); + logger->log1("Unloading char database..."); mLoaded = false; } diff --git a/src/resources/db/colordb.cpp b/src/resources/db/colordb.cpp index 96af379a4..100688d7f 100644 --- a/src/resources/db/colordb.cpp +++ b/src/resources/db/colordb.cpp @@ -43,6 +43,8 @@ void ColorDB::load() if (mLoaded) unload(); + logger->log1("Initializing color database..."); + std::map<ItemColor, ItemColorData> colors; ColorListsIterator it = mColorLists.find("hair"); if (it != mColorLists.end()) diff --git a/src/resources/db/commandsdb.cpp b/src/resources/db/commandsdb.cpp index 0f3046047..4fc5136c4 100644 --- a/src/resources/db/commandsdb.cpp +++ b/src/resources/db/commandsdb.cpp @@ -40,6 +40,7 @@ void CommandsDB::load() { if (mLoaded) unload(); + logger->log1("Initializing commands database..."); loadXmlFile(paths.getStringValue("defaultCommandsFile"), SkipError_false); loadXmlFile(paths.getStringValue("defaultCommandsPatchFile"), @@ -150,6 +151,7 @@ void CommandsDB::loadXmlFile(const std::string &fileName, void CommandsDB::unload() { + logger->log1("Unloading commands database..."); mCommands.clear(); mLoaded = false; } diff --git a/src/resources/db/deaddb.cpp b/src/resources/db/deaddb.cpp index 8c273e239..632c3a79f 100644 --- a/src/resources/db/deaddb.cpp +++ b/src/resources/db/deaddb.cpp @@ -40,6 +40,8 @@ void DeadDB::load() if (mLoaded) unload(); + logger->log1("Initializing dead database..."); + loadXmlFile(paths.getStringValue("deadMessagesFile"), SkipError_false); loadXmlFile(paths.getStringValue("deadMessagesPatchFile"), SkipError_true); loadXmlDir("deadMessagesPatchDir", loadXmlFile); @@ -92,6 +94,7 @@ void DeadDB::loadXmlFile(const std::string &fileName, void DeadDB::unload() { + logger->log1("Unloading dead database..."); mMessages.clear(); mLoaded = false; } diff --git a/src/resources/db/elementaldb.cpp b/src/resources/db/elementaldb.cpp index 9624366f6..ce11dfeda 100644 --- a/src/resources/db/elementaldb.cpp +++ b/src/resources/db/elementaldb.cpp @@ -126,6 +126,7 @@ void ElementalDb::loadXmlFile(const std::string &fileName, void ElementalDb::unload() { + logger->log1("Unloading elemental database..."); delete_all(mElementalInfos); mElementalInfos.clear(); diff --git a/src/resources/db/emotedb.cpp b/src/resources/db/emotedb.cpp index 72b7f0092..f25b14c5a 100644 --- a/src/resources/db/emotedb.cpp +++ b/src/resources/db/emotedb.cpp @@ -49,6 +49,8 @@ void EmoteDB::load() if (mLoaded) unload(); + logger->log1("Initializing emote database..."); + EmoteSprite *const unknownSprite = new EmoteSprite; unknownSprite->sprite = AnimatedSprite::load(pathJoin(paths.getStringValue( "sprites"), paths.getStringValue( @@ -57,8 +59,6 @@ void EmoteDB::load() unknownSprite->id = 0; mUnknown.sprites.push_back(unknownSprite); - logger->log1("Initializing emote database..."); - mLastEmote = 0; loadXmlFile(paths.getStringValue("emotesFile"), SkipError_false); loadXmlFile(paths.getStringValue("emotesPatchFile"), SkipError_true); @@ -224,6 +224,7 @@ void EmoteDB::loadSpecialXmlFile(const std::string &fileName, void EmoteDB::unload() { + logger->log1("Unloading emote database..."); FOR_EACH (EmoteInfos::const_iterator, i, mEmoteInfos) { if (i->second != nullptr) diff --git a/src/resources/db/groupdb.cpp b/src/resources/db/groupdb.cpp index 7b499018a..e4c909c9a 100644 --- a/src/resources/db/groupdb.cpp +++ b/src/resources/db/groupdb.cpp @@ -41,6 +41,8 @@ void GroupDb::load() if (mLoaded) unload(); + logger->log1("Initializing group database..."); + loadXmlFile(paths.getStringValue("groupsFile"), SkipError_false); loadXmlFile(paths.getStringValue("groupsPatchFile"), SkipError_true); loadXmlDir("groupsPatchDir", loadXmlFile); @@ -320,6 +322,7 @@ void GroupDb::loadXmlFile(const std::string &fileName, void GroupDb::unload() { + logger->log1("Unloading group database..."); FOR_EACH (GroupInfosIter, it, mGroups) { delete (*it).second; diff --git a/src/resources/db/homunculusdb.cpp b/src/resources/db/homunculusdb.cpp index bedc7c319..a6453661a 100644 --- a/src/resources/db/homunculusdb.cpp +++ b/src/resources/db/homunculusdb.cpp @@ -133,13 +133,13 @@ void HomunculusDB::loadXmlFile(const std::string &fileName, void HomunculusDB::unload() { + logger->log1("Unloading homunculus database..."); delete_all(mHomunculusInfos); mHomunculusInfos.clear(); mLoaded = false; } - BeingInfo *HomunculusDB::get(const BeingTypeId id) { BeingInfoIterator i = mHomunculusInfos.find(id); diff --git a/src/resources/db/horsedb.cpp b/src/resources/db/horsedb.cpp index c9f363246..a59c18e3f 100644 --- a/src/resources/db/horsedb.cpp +++ b/src/resources/db/horsedb.cpp @@ -61,6 +61,8 @@ void HorseDB::load() if (mLoaded) unload(); + logger->log1("Initializing horse database..."); + SpriteReference *currentSprite = new SpriteReference; currentSprite->sprite = pathJoin(paths.getStringValue("sprites"), paths.getStringValue("spriteErrorFile")); @@ -73,8 +75,6 @@ void HorseDB::load() currentSprite->variant = 0; mUnknown.upSprites.push_back(currentSprite); - logger->log1("Initializing horse database..."); - loadXmlFile(paths.getStringValue("horsesFile"), SkipError_false); loadXmlFile(paths.getStringValue("horsesPatchFile"), SkipError_true); loadXmlDir("horsesPatchDir", loadXmlFile); @@ -264,6 +264,7 @@ static void loadUpSprites(XmlNodePtrConst parentNode, void HorseDB::unload() { + logger->log1("Unloading horse database..."); FOR_EACH (HorseInfos::const_iterator, i, mHorseInfos) { delete_all(i->second->upSprites); diff --git a/src/resources/db/itemoptiondb.cpp b/src/resources/db/itemoptiondb.cpp index 2f7fc1ccd..b138e7521 100644 --- a/src/resources/db/itemoptiondb.cpp +++ b/src/resources/db/itemoptiondb.cpp @@ -42,6 +42,7 @@ void ItemOptionDb::load() if (mLoaded) unload(); + logger->log1("Initializing item options database..."); loadXmlFile(paths.getStringValue("itemOptionsFile"), SkipError_false); loadXmlFile(paths.getStringValue("itemOptionsPatchFile"), SkipError_true); loadXmlDir("itemOptionsPatchDir", loadXmlFile); @@ -136,6 +137,7 @@ void ItemOptionDb::loadXmlFile(const std::string &fileName, void ItemOptionDb::unload() { + logger->log1("Unloading item options database..."); mOptions.clear(); mLoaded = false; } diff --git a/src/resources/db/languagedb.cpp b/src/resources/db/languagedb.cpp index a5443824e..8d04e5c2e 100644 --- a/src/resources/db/languagedb.cpp +++ b/src/resources/db/languagedb.cpp @@ -39,6 +39,7 @@ namespace void LanguageDb::load() { unload(); + logger->log1("Initializing languages database..."); loadXmlFile(paths.getStringValue("languagesFile"), SkipError_false); loadXmlFile(paths.getStringValue("languagesPatchFile"), SkipError_true); loadXmlDir("languagesPatchDir", loadXmlFile); @@ -101,6 +102,7 @@ void LanguageDb::loadXmlFile(const std::string &fileName, void LanguageDb::unload() { + logger->log1("Unloading languages database..."); mIcons.clear(); mPo.clear(); } diff --git a/src/resources/db/mapdb.cpp b/src/resources/db/mapdb.cpp index 7ae90815e..2b5dd2185 100644 --- a/src/resources/db/mapdb.cpp +++ b/src/resources/db/mapdb.cpp @@ -47,6 +47,7 @@ void MapDB::load() if (mLoaded) unload(); + logger->log1("Initializing maps database..."); loadRemapXmlFile(paths.getStringValue("mapsRemapFile"), SkipError_true); loadRemapXmlFile(paths.getStringValue("mapsRemapPatchFile"), diff --git a/src/resources/db/mercenarydb.cpp b/src/resources/db/mercenarydb.cpp index ca1b950f9..464daac63 100644 --- a/src/resources/db/mercenarydb.cpp +++ b/src/resources/db/mercenarydb.cpp @@ -130,6 +130,7 @@ void MercenaryDB::loadXmlFile(const std::string &fileName, void MercenaryDB::unload() { + logger->log1("Unloading mercenary database..."); delete_all(mMercenaryInfos); mMercenaryInfos.clear(); diff --git a/src/resources/db/moddb.cpp b/src/resources/db/moddb.cpp index 9f69c9891..7db96f4bd 100644 --- a/src/resources/db/moddb.cpp +++ b/src/resources/db/moddb.cpp @@ -42,6 +42,7 @@ void ModDB::load() { if (mLoaded) unload(); + logger->log1("Initializing mod database..."); loadXmlFile(paths.getStringValue("modsFile"), SkipError_false); loadXmlFile(paths.getStringValue("modsPatchFile"), SkipError_true); loadXmlDir("modsPatchDir", loadXmlFile); @@ -97,6 +98,7 @@ void ModDB::loadXmlFile(const std::string &fileName, void ModDB::unload() { + logger->log1("Unloading mod database..."); delete_all(mModInfos); mModInfos.clear(); mLoaded = false; diff --git a/src/resources/db/monsterdb.cpp b/src/resources/db/monsterdb.cpp index a8a040973..59b8f9808 100644 --- a/src/resources/db/monsterdb.cpp +++ b/src/resources/db/monsterdb.cpp @@ -133,6 +133,7 @@ void MonsterDB::loadXmlFile(const std::string &fileName, void MonsterDB::unload() { + logger->log1("Unloading monster database..."); delete_all(mMonsterInfos); mMonsterInfos.clear(); diff --git a/src/resources/db/networkdb.cpp b/src/resources/db/networkdb.cpp index 5c2230e7b..4ad9eb222 100644 --- a/src/resources/db/networkdb.cpp +++ b/src/resources/db/networkdb.cpp @@ -71,6 +71,7 @@ void NetworkDb::loadXmlFile(const std::string &fileName, void NetworkDb::unload() { + logger->log1("Unloading network database..."); mInPackets.clear(); mRemovePackets.clear(); mLoaded = false; diff --git a/src/resources/db/npcdb.cpp b/src/resources/db/npcdb.cpp index eafb9745e..12ab211f1 100644 --- a/src/resources/db/npcdb.cpp +++ b/src/resources/db/npcdb.cpp @@ -174,6 +174,7 @@ void NPCDB::loadXmlFile(const std::string &fileName, void NPCDB::unload() { + logger->log1("Unloading NPC database..."); delete_all(mNPCInfos); mNPCInfos.clear(); diff --git a/src/resources/db/npcdialogdb.cpp b/src/resources/db/npcdialogdb.cpp index 0e4ab5ffc..9d6825bfa 100644 --- a/src/resources/db/npcdialogdb.cpp +++ b/src/resources/db/npcdialogdb.cpp @@ -41,7 +41,7 @@ void NpcDialogDB::load() if (mLoaded) unload(); - logger->log1("Loading npcdialog database..."); + logger->log1("Loading npc dialog database..."); loadXmlFile(paths.getStringValue("npcDialogsFile"), SkipError_false); loadXmlFile(paths.getStringValue("npcDialogsPatchFile"), SkipError_true); loadXmlDir("npcDialogsPatchDir", loadXmlFile); @@ -205,7 +205,7 @@ void NpcDialogDB::deleteDialog(const std::string &name) void NpcDialogDB::unload() { - logger->log1("Unloading npcdialog database..."); + logger->log1("Unloading npc dialog database..."); FOR_EACH (DialogsIter, it, mDialogs) { diff --git a/src/resources/db/palettedb.cpp b/src/resources/db/palettedb.cpp index 0390550d4..484e62751 100644 --- a/src/resources/db/palettedb.cpp +++ b/src/resources/db/palettedb.cpp @@ -41,6 +41,7 @@ void PaletteDB::load() if (mLoaded) unload(); + logger->log1("Initializing palette database..."); loadPalette(); } @@ -100,6 +101,7 @@ void PaletteDB::loadPalette() void PaletteDB::unload() { + logger->log1("Unloading palette database..."); mColors.clear(); } diff --git a/src/resources/db/petdb.cpp b/src/resources/db/petdb.cpp index ccfaecda9..2710356ae 100644 --- a/src/resources/db/petdb.cpp +++ b/src/resources/db/petdb.cpp @@ -146,6 +146,7 @@ void PETDB::loadXmlFile(const std::string &fileName, void PETDB::unload() { + logger->log1("Unloading PET database..."); delete_all(mPETInfos); mPETInfos.clear(); diff --git a/src/resources/db/questdb.cpp b/src/resources/db/questdb.cpp index 44c59226c..d932b656e 100644 --- a/src/resources/db/questdb.cpp +++ b/src/resources/db/questdb.cpp @@ -46,6 +46,7 @@ namespace void QuestDb::load() { unload(); + logger->log1("Initializing quest database..."); loadXmlFile(paths.getStringValue("questsFile"), SkipError_false); loadXmlFile(paths.getStringValue("questsPatchFile"), SkipError_true); loadXmlDir("questsPatchDir", loadXmlFile); @@ -213,6 +214,7 @@ void QuestDb::loadXmlFile(const std::string &fileName, void QuestDb::unload() { + logger->log1("Unloading quest database..."); for (std::map<int, STD_VECTOR<QuestItem*> >::iterator it = mQuests.begin(), it_end = mQuests.end(); it != it_end; ++ it) { diff --git a/src/resources/db/skillunitdb.cpp b/src/resources/db/skillunitdb.cpp index 33f41cacb..d7028e672 100644 --- a/src/resources/db/skillunitdb.cpp +++ b/src/resources/db/skillunitdb.cpp @@ -139,6 +139,7 @@ void SkillUnitDb::loadXmlFile(const std::string &fileName, void SkillUnitDb::unload() { + logger->log1("Unloading skill unit database..."); delete_all(mSkillUnitInfos); mSkillUnitInfos.clear(); diff --git a/src/resources/db/sounddb.cpp b/src/resources/db/sounddb.cpp index 90dc9fe00..7c9ecbdd0 100644 --- a/src/resources/db/sounddb.cpp +++ b/src/resources/db/sounddb.cpp @@ -21,6 +21,7 @@ #include "resources/db/sounddb.h" #include "configuration.h" +#include "logger.h" #include "notifymanager.h" #include "enums/resources/notifytypes.h" @@ -38,6 +39,7 @@ namespace void SoundDB::load() { unload(); + logger->log1("Initializing sound database..."); loadXmlFile(paths.getStringValue("soundsFile"), SkipError_false); loadXmlFile(paths.getStringValue("soundsPatchFile"), SkipError_true); loadXmlDir("soundsPatchDir", loadXmlFile); @@ -83,6 +85,7 @@ void SoundDB::loadXmlFile(const std::string &fileName, void SoundDB::unload() { + logger->log1("Unloading sound database..."); mSounds.resize(NotifyTypes::TYPE_END); for (int f = 0; f < NotifyTypes::TYPE_END; f ++) mSounds[f].clear(); diff --git a/src/resources/db/statuseffectdb.cpp b/src/resources/db/statuseffectdb.cpp index d5fc96849..b02c666d6 100644 --- a/src/resources/db/statuseffectdb.cpp +++ b/src/resources/db/statuseffectdb.cpp @@ -71,6 +71,8 @@ void StatusEffectDB::load() if (mLoaded) unload(); + logger->log1("Initializing status effect database..."); + loadXmlFile(paths.getStringValue("statusEffectsFile"), SkipError_false); loadXmlFile(paths.getStringValue("statusEffectsPatchFile"), SkipError_true); @@ -213,6 +215,8 @@ void StatusEffectDB::unload() if (!mLoaded) return; + logger->log1("Unloading status effect database..."); + fakeId = 10000; unloadMap(statusEffects[0]); unloadMap(statusEffects[1]); diff --git a/src/resources/db/textdb.cpp b/src/resources/db/textdb.cpp index e4d0b9b65..cfd5faf76 100644 --- a/src/resources/db/textdb.cpp +++ b/src/resources/db/textdb.cpp @@ -36,6 +36,7 @@ namespace void TextDb::load() { unload(); + logger->log1("Initializing text database..."); loadXmlFile(paths.getStringValue("textsFile"), SkipError_false); loadXmlFile(paths.getStringValue("textsPatchFile"), SkipError_true); loadXmlDir("textsPatchDir", loadXmlFile); @@ -83,6 +84,7 @@ void TextDb::loadXmlFile(const std::string &fileName, void TextDb::unload() { + logger->log1("Unloading text database..."); mTexts.clear(); } diff --git a/src/resources/db/unitsdb.cpp b/src/resources/db/unitsdb.cpp index bf498411b..ab42ba04c 100644 --- a/src/resources/db/unitsdb.cpp +++ b/src/resources/db/unitsdb.cpp @@ -69,8 +69,9 @@ static std::string formatUnit(const int value, static std::string splitNumber(std::string str, const std::string &separator); -void UnitsDb::loadUnits() +void UnitsDb::load() { + logger->log1("Initializing unit database..."); { // Setup default weight UnitDescription ud; @@ -115,6 +116,12 @@ void UnitsDb::loadUnits() loadXmlDir("unitsPatchDir", loadXmlFile); } +void UnitsDb::unload() +{ + logger->log1("Unloading unit database..."); + mCurrencies.clear(); +} + static UnitDescription loadUnit(XmlNodePtr node) { UnitDescription ud; diff --git a/src/resources/db/unitsdb.h b/src/resources/db/unitsdb.h index 68cafe554..0681567c0 100644 --- a/src/resources/db/unitsdb.h +++ b/src/resources/db/unitsdb.h @@ -34,7 +34,9 @@ namespace UnitsDb /** * Loads and parses the units.xml file (if found). */ - void loadUnits(); + void load(); + + void unload(); void loadXmlFile(const std::string &fileName, const SkipError skipError); diff --git a/src/resources/db/weaponsdb.cpp b/src/resources/db/weaponsdb.cpp index e75b15f02..f23a0dfc3 100644 --- a/src/resources/db/weaponsdb.cpp +++ b/src/resources/db/weaponsdb.cpp @@ -21,6 +21,7 @@ #include "resources/db/weaponsdb.h" #include "configuration.h" +#include "logger.h" #include "utils/xmlutils.h" @@ -51,6 +52,8 @@ void WeaponsDB::load() if (mLoaded) unload(); + logger->log1("Initializing weapon database..."); + loadDB("swords", mSwords); loadDB("bows", mBows); loadDB("shields", mShields); @@ -58,6 +61,8 @@ void WeaponsDB::load() void WeaponsDB::unload() { + logger->log1("Unloading weapon database..."); + mBows.clear(); mSwords.clear(); mShields.clear(); diff --git a/src/resources/dbmanager.cpp b/src/resources/dbmanager.cpp index 43bef80ca..6a0ee16d7 100644 --- a/src/resources/dbmanager.cpp +++ b/src/resources/dbmanager.cpp @@ -91,7 +91,7 @@ void DbManager::loadDb() AvatarDB::load(); BadgesDB::load(); WeaponsDB::load(); - UnitsDb::loadUnits(); + UnitsDb::load(); NPCDB::load(); NpcDialogDB::load(); PETDB::load(); @@ -131,6 +131,7 @@ void DbManager::unloadDb() AvatarDB::unload(); BadgesDB::unload(); WeaponsDB::unload(); + UnitsDb::unload(); PaletteDB::unload(); PETDB::unload(); StatusEffectDB::unload(); |