From 8615f1bbad630602009c04a317cd83e03aaa620c Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Thu, 3 Jun 2010 14:12:42 -0600 Subject: Unload loaded DBs before loading them again MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This greatly simplifies handling DBs when changing states. No more need to manage unloading in Client (except when exiting). Reviewed-by: Thorbjørn Lindeijer --- src/client.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/client.cpp') diff --git a/src/client.cpp b/src/client.cpp index aa48591f..93450805 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -422,6 +422,14 @@ Client::~Client() SDL_RemoveTimer(mLogicCounterId); SDL_RemoveTimer(mSecondsCounterId); + // Unload XML databases + ColorDB::unload(); + EmoteDB::unload(); + ItemDB::unload(); + MonsterDB::unload(); + NPCDB::unload(); + StatusEffect::unload(); + // Before config.write() since it writes the shortcuts to the config delete itemShortcut; delete emoteShortcut; @@ -575,14 +583,6 @@ int Client::exec() { delete game; game = 0; - - // Unload XML databases - ColorDB::unload(); - EmoteDB::unload(); - ItemDB::unload(); - MonsterDB::unload(); - NPCDB::unload(); - StatusEffect::unload(); } mOldState = mState; -- cgit v1.2.3-60-g2f50