summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-04-23 18:01:28 +0300
committerAndrei Karas <akaras@inbox.ru>2012-04-23 18:01:28 +0300
commitb9e27e9563e32a17cd80142ce05b5770479cc709 (patch)
tree395086bce491e0b3050bf482b2fe0161a3c3537f
parenta86324d5fb520823ecb35e828dfeccf9ac2bba81 (diff)
downloadmv-b9e27e9563e32a17cd80142ce05b5770479cc709.tar.gz
mv-b9e27e9563e32a17cd80142ce05b5770479cc709.tar.bz2
mv-b9e27e9563e32a17cd80142ce05b5770479cc709.tar.xz
mv-b9e27e9563e32a17cd80142ce05b5770479cc709.zip
Add support for independent per server updates.
-rw-r--r--src/gui/updaterwindow.cpp23
-rw-r--r--src/gui/updaterwindow.h2
2 files changed, 25 insertions, 0 deletions
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<updateFile> 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: