diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2006-07-18 15:52:42 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2006-07-18 15:52:42 +0000 |
commit | 151abcad30a0e1582b91b58b4a42343f5686979c (patch) | |
tree | 74327dc22f72763716e293f803fe2849ae397847 /src/main.cpp | |
parent | d6f4f362895b1b0aa3681a8255c7f996457d79cd (diff) | |
download | mana-151abcad30a0e1582b91b58b4a42343f5686979c.tar.gz mana-151abcad30a0e1582b91b58b4a42343f5686979c.tar.bz2 mana-151abcad30a0e1582b91b58b4a42343f5686979c.tar.xz mana-151abcad30a0e1582b91b58b4a42343f5686979c.zip |
Updated the updating system. It will now only load those updates
specified in the downloaded resources.txt file, and in the order
in which they are mentioned (the top one being the most
significant).
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/src/main.cpp b/src/main.cpp index 20a1771c..a4ef390e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -163,10 +163,6 @@ void init_engine() // Add the main data directory to our PhysicsFS search path resman->addToSearchPath("data", true); resman->addToSearchPath(TMW_DATADIR "data", true); - // Add zip files to PhysicsFS - resman->searchAndAddArchives("/", ".zip", true); - // Updates, these override other files - resman->searchAndAddArchives("/updates", ".zip", false); // Fill configuration with defaults config.setValue("host", "animesites.de"); @@ -391,6 +387,22 @@ void parseOptions(int argc, char *argv[], Options &options) } } +/** + * Reads the file "updates/resources.txt" and attempts to load each update + * mentioned in it. + */ +void loadUpdates() +{ + const std::string updatesFile = "updates/resources.txt"; + ResourceManager *resman = ResourceManager::getInstance(); + std::vector<std::string> lines = resman->loadTextFile(updatesFile); + + for (unsigned int i = 0; i < lines.size(); ++i) + { + resman->addToSearchPath(lines[i], false); + } +} + CharServerHandler charServerHandler; LoginData loginData; LoginHandler loginHandler; @@ -503,14 +515,17 @@ int main(int argc, char *argv[]) SDL_Event event; - if (options.skipUpdate && state != ERROR_STATE) - { + if (options.skipUpdate && state != ERROR_STATE) { + loadUpdates(); state = LOGIN_STATE; } + else { + state = UPDATE_STATE; + } unsigned int oldstate = !state; // We start with a status change. - Window *currentDialog = NULL; + Window *currentDialog = NULL; Image *login_wallpaper = NULL; Game *game = NULL; @@ -581,8 +596,7 @@ int main(int argc, char *argv[]) switch (oldstate) { case UPDATE_STATE: - ResourceManager::getInstance()-> - searchAndAddArchives("/updates", ".zip", 0); + loadUpdates(); break; // Those states don't cause a network disconnect |