diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-08-22 14:14:34 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-08-22 14:14:34 +0300 |
commit | da05d9dd98315378bdded216184294f376643191 (patch) | |
tree | ffc4b984c73c3bb68d26a1df6481634254075744 /src/client.cpp | |
parent | ec856b2026c7ceecab5f74942bb36661d7c6ae67 (diff) | |
download | plus-da05d9dd98315378bdded216184294f376643191.tar.gz plus-da05d9dd98315378bdded216184294f376643191.tar.bz2 plus-da05d9dd98315378bdded216184294f376643191.tar.xz plus-da05d9dd98315378bdded216184294f376643191.zip |
Use resource manager as global variable.
Diffstat (limited to 'src/client.cpp')
-rw-r--r-- | src/client.cpp | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/src/client.cpp b/src/client.cpp index 2e3cc7374..8c8276f7e 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -278,8 +278,7 @@ void Client::gameInit() #endif ResourceManager::init(); - const ResourceManager *const resman = ResourceManager::getInstance(); - if (!resman->setWriteDir(settings.localDataDir)) + if (!resourceManager->setWriteDir(settings.localDataDir)) { logger->error(strprintf("%s couldn't be set as home directory! " "Exiting.", settings.localDataDir.c_str())); @@ -358,10 +357,10 @@ void Client::gameInit() // Add the main data directories to our PhysicsFS search path if (!settings.options.dataPath.empty()) - resman->addToSearchPath(settings.options.dataPath, false); + resourceManager->addToSearchPath(settings.options.dataPath, false); // Add the local data directory to PhysicsFS search path - resman->addToSearchPath(settings.localDataDir, false); + resourceManager->addToSearchPath(settings.localDataDir, false); TranslationManager::loadCurrentLang(); WindowManager::initTitle(); @@ -933,8 +932,7 @@ int Client::gameExec() { delete2(mGame); Game::clearInstance(); - ResourceManager *const resman = ResourceManager::getInstance(); - resman->cleanOrphans(); + resourceManager->cleanOrphans(); Party::clearParties(); Guild::clearGuilds(); NpcDialog::clearDialogs(); @@ -980,12 +978,10 @@ int Client::gameExec() logger->log1("State: CHOOSE SERVER"); mCurrentServer.supportUrl.clear(); settings.supportUrl.clear(); - ResourceManager *const resman - = ResourceManager::getInstance(); if (settings.options.dataPath.empty()) { // Add customdata directory - resman->searchAndRemoveArchives( + resourceManager->searchAndRemoveArchives( "customdata/", "zip"); } @@ -998,15 +994,19 @@ int Client::gameExec() if (!settings.options.skipUpdate) { - resman->searchAndRemoveArchives( - settings.updatesDir + "/local/", + resourceManager->searchAndRemoveArchives( + settings.updatesDir + + "/local/", "zip"); - resman->removeFromSearchPath(settings.localDataDir - + dirSeparator + settings.updatesDir + "/local/"); + resourceManager->removeFromSearchPath( + settings.localDataDir + + dirSeparator + + settings.updatesDir + + "/local/"); } - resman->clearCache(); + resourceManager->clearCache(); loginData.clearUpdateHost(); serverVersion = 0; @@ -1191,15 +1191,12 @@ int Client::gameExec() BLOCK_START("Client::gameExec STATE_LOAD_DATA") logger->log1("State: LOAD DATA"); - const ResourceManager *const resman - = ResourceManager::getInstance(); - // If another data path has been set, // we don't load any other files... if (settings.options.dataPath.empty()) { // Add customdata directory - resman->searchAndAddArchives( + resourceManager->searchAndAddArchives( "customdata/", "zip", false); @@ -1207,12 +1204,12 @@ int Client::gameExec() if (!settings.options.skipUpdate) { - resman->searchAndAddArchives( + resourceManager->searchAndAddArchives( settings.updatesDir + "/local/", "zip", false); - resman->addToSearchPath(settings.localDataDir + resourceManager->addToSearchPath(settings.localDataDir + dirSeparator + settings.updatesDir + "/local/", false); } |