diff options
author | rubidium <rubidium@openttd.org> | 2009-01-17 16:53:32 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-01-17 16:53:32 +0000 |
commit | 72b0341ed01caed7053df6f2ca7f9530d1f67e40 (patch) | |
tree | 76215ba6e27bc0b1f49919c01ff2608f276b8e3d /src/network/network_gui.cpp | |
parent | 3940ed7e6f0bcb4fbe74c632254d6824692864dd (diff) | |
download | openttd-72b0341ed01caed7053df6f2ca7f9530d1f67e40.tar.xz |
(svn r15126) -Feature: downloading content from a central server (content.openttd.org) where authors can upload they NewGRFS/AI etc. This should make joining servers that use only NewGRFs that are distributed via this system easier as the players can download the NewGRFs from in the game. It should also make it easier to see whether there are updates for NewGRFs and make the necessary updates.
Diffstat (limited to 'src/network/network_gui.cpp')
-rw-r--r-- | src/network/network_gui.cpp | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp index e130b7770..f9b0b7cc9 100644 --- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -11,6 +11,7 @@ #include "../fios.h" #include "network_internal.h" #include "network_client.h" +#include "network_content.h" #include "network_gui.h" #include "network_gamelist.h" #include "../gui.h" @@ -76,7 +77,7 @@ enum { * @param unselect unselect the currently selected item */ void UpdateNetworkGameWindow(bool unselect) { - InvalidateWindowData(WC_NETWORK_WINDOW, 0, unselect); + InvalidateWindowData(WC_NETWORK_WINDOW, 0, unselect ? 1 : 0); } /** Enum for NetworkGameWindow, referring to _network_game_window_widgets */ @@ -595,9 +596,36 @@ public: virtual void OnInvalidateData(int data) { - if (data != 0) { - this->server = NULL; - this->list_pos = SLP_INVALID; + switch (data) { + /* Remove the selection */ + case 1: + this->server = NULL; + this->list_pos = SLP_INVALID; + break; + + /* Reiterate the whole server list as we downloaded some files */ + case 2: + for (NetworkGameList **iter = this->servers.Begin(); iter != this->servers.End(); iter++) { + NetworkGameList *item = *iter; + bool missing_grfs = false; + for (GRFConfig *c = item->info.grfconfig; c != NULL; c = c->next) { + if (c->status != GCS_NOT_FOUND) continue; + + const GRFConfig *f = FindGRFConfig(c->grfid, c->md5sum); + if (f == NULL) { + missing_grfs = true; + continue; + } + + c->filename = f->filename; + c->name = f->name; + c->info = f->info; + c->status = GCS_UNKNOWN; + } + + if (!missing_grfs) item->info.compatible = item->info.version_compatible; + } + break; } this->servers.ForceRebuild(); this->SetDirty(); |