From 2c87e95bba63a1c5b083d1a1165ec2479e9e35f8 Mon Sep 17 00:00:00 2001 From: James Turner Date: Sat, 29 Dec 2012 14:39:26 +0000 Subject: [PATCH] Final part of #450 - dynamic MP server list. When the dynamic retrieval fails, fall-back to a local list. Note for this to work needed some minor fg+sg tweaks which are also pushed now. --- gui/dialogs/multiplayer.xml | 39 ++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/gui/dialogs/multiplayer.xml b/gui/dialogs/multiplayer.xml index 301bdb2fe..f753abfbe 100644 --- a/gui/dialogs/multiplayer.xml +++ b/gui/dialogs/multiplayer.xml @@ -46,8 +46,34 @@ gui.dialog_update("multiplayer", "host"); } + var static_serverList = [ + ['mpserver01.flightgear.org', 'Frankfurt, Germany'], + ['mpserver02.flightgear.org', 'Kansas, USA'], + ['mpserver03.flightgear.org', 'Germany'], + ['mpserver04.flightgear.org', 'United Kingdom'], + ['mpserver05.flightgear.org', 'Chicago, USA'], + ['mpserver07.flightgear.org', 'Wisconsin, USA'], + ['mpserver08.flightgear.org', 'Frankfurt am Main, Germany'], + ['mpserver09.flightgear.org', 'Koln, Germany'], + ['mpserver10.flightgear.org', 'Montpellier, France'], + ['mpserver11.flightgear.org', 'Vilnius, Lithuania'], + ['mpserver12.flightgear.org', 'Amsterdam, Netherlands'], + ['mpserver13.flightgear.org', 'Grenoble, France'] + ]; + var updateServersFailed = func { debug.dump("Failed to retrieve server list!"); + + servers.removeChildren("value"); + var i=0; + foreach (var s; static_serverList) { + # create the node the PUI combo + var nm = s[0] ~ " - " ~ s[1]; + servers.getNode("value[" ~ i ~ "]", 1).setValue(nm); + i += 1; + } + + gui.dialog_update("multiplayer", "host"); } # listen for results arriving @@ -161,19 +187,6 @@ false /sim/gui/dialogs/multiplay/servers -