Port game speed selection to new lobby backend.

This commit is contained in:
Paul Chote
2016-07-02 10:51:55 +01:00
parent e858e13da7
commit 7caf636222
10 changed files with 52 additions and 118 deletions

View File

@@ -403,8 +403,6 @@ namespace OpenRA.Server
if (handshake.Mod == "{DEV_VERSION}")
SendMessage("{0} is running an unversioned development build, ".F(client.Name) +
"and may desynchronize the game state if they have incompatible rules.");
SetOrderLag();
}
catch (Exception ex)
{
@@ -414,24 +412,6 @@ namespace OpenRA.Server
}
}
void SetOrderLag()
{
int latency = 1;
if (!LobbyInfo.IsSinglePlayer)
{
var gameSpeeds = ModData.Manifest.Get<GameSpeeds>();
GameSpeed speed;
if (gameSpeeds.Speeds.TryGetValue(LobbyInfo.GlobalSettings.GameSpeedType, out speed))
latency = speed.OrderLatency;
else
latency = 3;
}
LobbyInfo.GlobalSettings.OrderLatency = latency;
SyncLobbyGlobalSettings();
}
void DispatchOrdersToClient(Connection c, int client, int frame, byte[] data)
{
try
@@ -620,8 +600,6 @@ namespace OpenRA.Server
toDrop.Socket.Disconnect(false);
}
catch { }
SetOrderLag();
}
public void SyncLobbyInfo()
@@ -702,6 +680,10 @@ namespace OpenRA.Server
DropClient(c);
}
// HACK: Turn down the latency if there is only one real player
if (LobbyInfo.IsSinglePlayer)
LobbyInfo.GlobalSettings.OrderLatency = 1;
SyncLobbyInfo();
State = ServerState.GameStarted;