From b9e27e9563e32a17cd80142ce05b5770479cc709 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 23 Apr 2012 18:01:28 +0300 Subject: Add support for independent per server updates. --- src/gui/updaterwindow.cpp | 23 +++++++++++++++++++++++ src/gui/updaterwindow.h | 2 ++ 2 files changed, 25 insertions(+) (limited to 'src') diff --git a/src/gui/updaterwindow.cpp b/src/gui/updaterwindow.cpp index a1c625c32..eb2fe2f82 100644 --- a/src/gui/updaterwindow.cpp +++ b/src/gui/updaterwindow.cpp @@ -522,6 +522,7 @@ void UpdaterWindow::loadUpdates() UpdaterWindow::addUpdateFile(resman, mUpdatesDir, fixPath, mUpdateFiles[mUpdateIndex].name, false); } + loadManaPlusUpdates(mUpdatesDir, resman); } void UpdaterWindow::loadLocalUpdates(std::string dir) @@ -546,6 +547,28 @@ void UpdaterWindow::loadLocalUpdates(std::string dir) UpdaterWindow::addUpdateFile(resman, dir, fixPath, updateFiles[updateIndex].name, false); } + loadManaPlusUpdates(dir, resman); +} + +void UpdaterWindow::loadManaPlusUpdates(std::string dir, + ResourceManager *resman) +{ + std::string fixPath = dir + "/fix"; + std::vector updateFiles + = loadXMLFile(fixPath + "/" + xmlUpdateFile); + + for (unsigned int updateIndex = 0; + updateIndex < updateFiles.size(); updateIndex ++) + { + std::string name = updateFiles[updateIndex].name; + if (strStartWith(name, "manaplus_")) + { + struct stat statbuf; + std::string file = fixPath + "/" + name; + if (!stat(file.c_str(), &statbuf)) + resman->addToSearchPath(file, false); + } + } } void UpdaterWindow::addUpdateFile(ResourceManager *resman, std::string path, diff --git a/src/gui/updaterwindow.h b/src/gui/updaterwindow.h index f8ee4e29c..5a9c95d9f 100644 --- a/src/gui/updaterwindow.h +++ b/src/gui/updaterwindow.h @@ -113,6 +113,8 @@ class UpdaterWindow : public Window, public gcn::ActionListener, std::string fixPath, std::string file, bool append); + static void loadManaPlusUpdates(std::string dir, ResourceManager *resman); + int updateState; private: -- cgit v1.2.3-70-g09d2