@@ -8,6 +8,7 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.Traits;
|
||||
@@ -162,13 +163,57 @@ namespace OpenRA.Network
|
||||
case "SyncInfo":
|
||||
{
|
||||
orderManager.LobbyInfo = Session.Deserialize(order.TargetString);
|
||||
SetOrderLag(orderManager);
|
||||
Game.SyncLobbyInfo();
|
||||
break;
|
||||
}
|
||||
|
||||
if (orderManager.FramesAhead != orderManager.LobbyInfo.GlobalSettings.OrderLatency
|
||||
&& !orderManager.GameStarted)
|
||||
case "SyncLobbyClients":
|
||||
{
|
||||
var clients = new List<Session.Client>();
|
||||
var nodes = MiniYaml.FromString(order.TargetString);
|
||||
foreach (var node in nodes)
|
||||
{
|
||||
orderManager.FramesAhead = orderManager.LobbyInfo.GlobalSettings.OrderLatency;
|
||||
Log.Write("server", "Order lag is now {0} frames.", orderManager.LobbyInfo.GlobalSettings.OrderLatency);
|
||||
var strings = node.Key.Split('@');
|
||||
if (strings[0] == "Client")
|
||||
clients.Add(FieldLoader.Load<Session.Client>(node.Value));
|
||||
}
|
||||
|
||||
orderManager.LobbyInfo.Clients = clients;
|
||||
Game.SyncLobbyInfo();
|
||||
break;
|
||||
}
|
||||
|
||||
case "SyncLobbySlots":
|
||||
{
|
||||
var slots = new Dictionary<string, Session.Slot>();
|
||||
var nodes = MiniYaml.FromString(order.TargetString);
|
||||
foreach (var node in nodes)
|
||||
{
|
||||
var strings = node.Key.Split('@');
|
||||
if (strings[0] == "Slot")
|
||||
{
|
||||
var slot = FieldLoader.Load<Session.Slot>(node.Value);
|
||||
slots.Add(slot.PlayerReference, slot);
|
||||
}
|
||||
}
|
||||
|
||||
orderManager.LobbyInfo.Slots = slots;
|
||||
Game.SyncLobbyInfo();
|
||||
break;
|
||||
}
|
||||
|
||||
case "SyncLobbyGlobalSettings":
|
||||
{
|
||||
var nodes = MiniYaml.FromString(order.TargetString);
|
||||
foreach (var node in nodes)
|
||||
{
|
||||
var strings = node.Key.Split('@');
|
||||
if (strings[0] == "GlobalSettings")
|
||||
FieldLoader.Load(orderManager.LobbyInfo.GlobalSettings, node.Value);
|
||||
}
|
||||
|
||||
SetOrderLag(orderManager);
|
||||
Game.SyncLobbyInfo();
|
||||
break;
|
||||
}
|
||||
@@ -227,5 +272,14 @@ namespace OpenRA.Network
|
||||
foreach (var nsc in w.ActorsWithTrait<INotifyStanceChanged>())
|
||||
nsc.Trait.StanceChanged(nsc.Actor, p, target, oldStance, s);
|
||||
}
|
||||
|
||||
static void SetOrderLag(OrderManager o)
|
||||
{
|
||||
if (o.FramesAhead != o.LobbyInfo.GlobalSettings.OrderLatency && !o.GameStarted)
|
||||
{
|
||||
o.FramesAhead = o.LobbyInfo.GlobalSettings.OrderLatency;
|
||||
Log.Write("server", "Order lag is now {0} frames.", o.LobbyInfo.GlobalSettings.OrderLatency);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user