From bb87f2911b63eaf80e49d689bf52ecf2042ae098 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 28 May 2014 20:31:09 +0300 Subject: Move from resourcemanager functions related to files into other files. --- src/gui/windows/chatwindow.cpp | 3 ++- src/gui/windows/helpwindow.cpp | 3 ++- src/gui/windows/minimap.cpp | 5 +++-- src/gui/windows/updaterwindow.cpp | 8 ++++---- 4 files changed, 11 insertions(+), 8 deletions(-) (limited to 'src/gui/windows') diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index 0ec192a89..fb7219ed9 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -73,6 +73,7 @@ #include "utils/copynpaste.h" #include "utils/delete2.h" +#include "utils/files.h" #include "utils/gettext.h" #include "resources/resourcemanager.h" @@ -219,7 +220,7 @@ void ChatWindow::postInit() void ChatWindow::loadCommandsFile(const std::string &name) { StringVect list; - ResourceManager::loadTextFile(name, list); + Files::loadTextFile(name, list); StringVectCIter it = list.begin(); const StringVectCIter it_end = list.end(); diff --git a/src/gui/windows/helpwindow.cpp b/src/gui/windows/helpwindow.cpp index 934e01359..e10900908 100644 --- a/src/gui/windows/helpwindow.cpp +++ b/src/gui/windows/helpwindow.cpp @@ -38,6 +38,7 @@ #include "resources/resourcemanager.h" #include "utils/gettext.h" +#include "utils/files.h" #include "utils/paths.h" #include "utils/process.h" @@ -153,7 +154,7 @@ void HelpWindow::loadTags() if (helpPath.empty()) helpPath = paths.getStringValue("help"); StringVect lines; - ResourceManager::loadTextFile(helpPath.append("tags.idx"), lines); + Files::loadTextFile(helpPath.append("tags.idx"), lines); FOR_EACH (StringVectCIter, it, lines) { const std::string &str = *it; diff --git a/src/gui/windows/minimap.cpp b/src/gui/windows/minimap.cpp index 3607d9584..5df1b60ce 100644 --- a/src/gui/windows/minimap.cpp +++ b/src/gui/windows/minimap.cpp @@ -44,6 +44,7 @@ #include "utils/delete2.h" #include "utils/gettext.h" +#include "utils/physfstools.h" #include "utils/sdlcheckutils.h" #include "debug.h" @@ -169,14 +170,14 @@ void Minimap::setMap(const Map *const map) std::string minimapName = map->getProperty("minimap"); - if (minimapName.empty() && resman->exists(tempname)) + if (minimapName.empty() && PhysFs::exists(tempname.c_str())) minimapName = tempname; if (minimapName.empty()) { tempname = std::string("graphics/minimaps/").append( map->getFilename()).append(".png"); - if (resman->exists(tempname)) + if (PhysFs::exists(tempname.c_str())) minimapName = tempname; } diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp index 45c18b21b..49b2e986f 100644 --- a/src/gui/windows/updaterwindow.cpp +++ b/src/gui/windows/updaterwindow.cpp @@ -46,6 +46,8 @@ #include "resources/db/moddb.h" #include "utils/delete2.h" +#include "utils/files.h" +#include "utils/physfstools.h" #include "utils/gettext.h" #include "utils/mkdir.h" #include "utils/paths.h" @@ -1020,8 +1022,7 @@ bool UpdaterWindow::validateFile(const std::string &filePath, unsigned long UpdaterWindow::getFileHash(const std::string &filePath) { int size = 0; - char *const buf = static_cast(ResourceManager::loadFile( - filePath, size)); + char *const buf = static_cast(PhysFs::loadFile(filePath, size)); if (!buf) return 0; return Net::Download::adlerBuffer(buf, size); @@ -1042,8 +1043,7 @@ void UpdaterWindow::loadFile(std::string file) trim(file); StringVect lines; - const ResourceManager *const resman = ResourceManager::getInstance(); - resman->loadTextFileLocal(mUpdatesDir + "/local/help/news.txt", lines); + Files::loadTextFileLocal(mUpdatesDir + "/local/help/news.txt", lines); for (size_t i = 0, sz = lines.size(); i < sz; ++i) mBrowserBox->addRow(lines[i]); -- cgit v1.2.3-70-g09d2