<URL: http://bugs.freeciv.org/Ticket/Display.html?id=40752 >

> [book - Mon Mar 23 01:14:03 2009]:
> 
> Sorry for the double post, I forgot to change out of the
> update page and refreshed it by mistake.
> 
> On 22/03/2009, Daniel Markstedt <markst...@gmail.com> wrote:
> > Same here, the old metaserver data was the fault.
> >
> > Isn't this bound to affect everyone who updates to 2.1.9?
> 
> Yes. Here's a somewhat hackish patch that automatically
> updates the default metaserver if it reads the old value
> from the civclientrc.

Here is version 2 that works for trunk and with corrected
formatting.


-----------------------------------------------------------------------
なんて手落ち。
diff --git a/client/client_main.c b/client/client_main.c
index 32f9c1c..6334a8e 100644
--- a/client/client_main.c
+++ b/client/client_main.c
@@ -403,8 +403,18 @@ int client_main(int argc, char *argv[])
     sz_strlcpy(server_host, default_server_host); 
   if (user_name[0] == '\0')
     sz_strlcpy(user_name, default_user_name); 
-  if (metaserver[0] == '\0')
-    sz_strlcpy(metaserver, default_metaserver); 
+  if (metaserver[0] == '\0') {
+    /* FIXME: Find a cleaner way to achieve this. */
+    const char *oldaddr = "http://meta.freeciv.org/metaserver.phtml";;
+    if (0 == strcmp(default_metaserver, oldaddr)) {
+      freelog(LOG_NORMAL, _("Updating old metaserver address \"%s\"."),
+              oldaddr);
+      sz_strlcpy(default_metaserver, META_URL);
+      freelog(LOG_NORMAL, _("Default metaserver has been set to \"%s\"."),
+              META_URL);
+    }
+    sz_strlcpy(metaserver, default_metaserver);
+  }
   if (server_port == -1) server_port = default_server_port;
 
   /* This seed is not saved anywhere; randoms in the client should
diff --git a/client/civclient.c b/client/civclient.c
index d0c26ed..f56ab3d 100644
--- a/client/civclient.c
+++ b/client/civclient.c
@@ -72,6 +72,7 @@
 #include "pages_g.h"
 #include "plrdlg_g.h"
 #include "repodlgs_g.h"
+#include "servers.h"
 #include "tilespec.h"
 #include "themes_common.h"
 
@@ -383,8 +384,18 @@ int main(int argc, char *argv[])
     sz_strlcpy(server_host, default_server_host); 
   if (user_name[0] == '\0')
     sz_strlcpy(user_name, default_user_name); 
-  if (metaserver[0] == '\0')
-    sz_strlcpy(metaserver, default_metaserver); 
+  if (metaserver[0] == '\0') {
+    /* FIXME: Find a cleaner way to achieve this. */
+    const char *oldaddr = "http://meta.freeciv.org/metaserver.phtml";;
+    if (0 == strcmp(default_metaserver, oldaddr)) {
+      freelog(LOG_NORMAL, _("Updating old metaserver address \"%s\"."),
+              oldaddr);
+      sz_strlcpy(default_metaserver, METALIST_ADDR);
+      freelog(LOG_NORMAL, _("Default metaserver has been set to \"%s\"."),
+              METALIST_ADDR);
+    }
+    sz_strlcpy(metaserver, default_metaserver);
+  }
   if (server_port == -1) server_port = default_server_port;
 
   /* This seed is not saved anywhere; randoms in the client should
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to