summaryrefslogtreecommitdiff
path: root/src/network/network_gui.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-01-17 16:53:32 +0000
committerrubidium <rubidium@openttd.org>2009-01-17 16:53:32 +0000
commit3a13b75e37b5642de3c1e89cf6ab3bf860b76375 (patch)
tree76215ba6e27bc0b1f49919c01ff2608f276b8e3d /src/network/network_gui.cpp
parent2850bf9e006ebdd40b5562cca5117bca027cfab5 (diff)
downloadopenttd-3a13b75e37b5642de3c1e89cf6ab3bf860b76375.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.cpp36
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();