Enforce color/race/team locking

This commit is contained in:
Paul Chote
2011-06-19 02:26:43 +12:00
parent 19d74fef52
commit 0c9190a1af

View File

@@ -54,6 +54,10 @@ namespace OpenRA.Mods.RA.Server
if (targetClient.Index != client.Index && conn.PlayerIndex != 0)
return true;
// Map has disabled race changes
if (server.lobbyInfo.Slots[targetClient.Slot].LockRace)
return true;
targetClient.Country = parts[1];
server.SyncLobbyInfo();
return true;
@@ -68,6 +72,10 @@ namespace OpenRA.Mods.RA.Server
if (targetClient.Index != client.Index && conn.PlayerIndex != 0)
return true;
// Map has disabled team changes
if (server.lobbyInfo.Slots[targetClient.Slot].LockTeam)
return true;
int team;
if (!int.TryParse(parts[1], out team)) { Log.Write("server", "Invalid team: {0}", s ); return false; }
@@ -116,6 +124,10 @@ namespace OpenRA.Mods.RA.Server
if (targetClient.Index != client.Index && conn.PlayerIndex != 0)
return true;
// Map has disabled color changes
if (targetClient.Slot != null && server.lobbyInfo.Slots[targetClient.Slot].LockColor)
return true;
var ci = parts[1].Split(',').Select(cc => int.Parse(cc)).ToArray();
targetClient.ColorRamp = new ColorRamp((byte)ci[0], (byte)ci[1], (byte)ci[2], (byte)ci[3]);
server.SyncLobbyInfo();