summaryrefslogtreecommitdiff
path: root/src/dyetool
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-08-22 14:14:34 +0300
committerAndrei Karas <akaras@inbox.ru>2015-08-22 14:14:34 +0300
commitda05d9dd98315378bdded216184294f376643191 (patch)
treeffc4b984c73c3bb68d26a1df6481634254075744 /src/dyetool
parentec856b2026c7ceecab5f74942bb36661d7c6ae67 (diff)
downloadmv-da05d9dd98315378bdded216184294f376643191.tar.gz
mv-da05d9dd98315378bdded216184294f376643191.tar.bz2
mv-da05d9dd98315378bdded216184294f376643191.tar.xz
mv-da05d9dd98315378bdded216184294f376643191.zip
Use resource manager as global variable.
Diffstat (limited to 'src/dyetool')
-rw-r--r--src/dyetool/client.cpp16
-rw-r--r--src/dyetool/dyemain.cpp10
2 files changed, 11 insertions, 15 deletions
diff --git a/src/dyetool/client.cpp b/src/dyetool/client.cpp
index 4722237d8..77964bd17 100644
--- a/src/dyetool/client.cpp
+++ b/src/dyetool/client.cpp
@@ -167,8 +167,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()));
@@ -246,10 +245,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();
@@ -587,15 +586,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);
@@ -603,12 +599,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);
}
diff --git a/src/dyetool/dyemain.cpp b/src/dyetool/dyemain.cpp
index 1d5f55a6d..84334ec21 100644
--- a/src/dyetool/dyemain.cpp
+++ b/src/dyetool/dyemain.cpp
@@ -75,10 +75,10 @@ int main(int argc, char **argv)
imageHelper = new SDLImageHelper;
#endif
- ResourceManager *resman = new ResourceManager;
- resman->setWriteDir(".");
- resman->addToSearchPath(".", false);
- resman->addToSearchPath("/", false);
+ ResourceManager::init();
+ resourceManager->setWriteDir(".");
+ resourceManager->addToSearchPath(".", false);
+ resourceManager->addToSearchPath("/", false);
std::string src = argv[1];
std::string dst;
if (argc == 4)
@@ -91,7 +91,7 @@ int main(int argc, char **argv)
dst = argv[2];
}
- Image *image = resman->getImage(src);
+ Image *image = resourceManager->getImage(src);
if (!image)
{
printf("Error loading image\n");