extract serialize code from Server; deserialize code from Game; add Slot collection.

This commit is contained in:
Chris Forbes
2010-08-23 19:08:09 +12:00
parent 3880326787
commit d8c5f1aed3
4 changed files with 58 additions and 34 deletions

View File

@@ -163,28 +163,7 @@ namespace OpenRA
internal static void SyncLobbyInfo(string data)
{
var session = new Session();
session.GlobalSettings.Mods = Settings.InitialMods;
var ys = MiniYaml.FromString(data);
foreach (var y in ys)
{
if (y.Key == "GlobalSettings")
{
FieldLoader.Load(session.GlobalSettings, y.Value);
continue;
}
int index;
if (!int.TryParse(y.Key, out index))
continue; // not a player.
var client = new Session.Client();
FieldLoader.Load(client, y.Value);
session.Clients.Add(client);
}
LobbyInfo = session;
LobbyInfo = Session.Deserialize(data);
if( !world.GameHasStarted )
world.SharedRandom = new XRandom( LobbyInfo.GlobalSettings.RandomSeed );