From 7a16c40edad04ee76a85e64c7f5bb7fc59e8b734 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Fri, 19 Mar 2010 18:38:23 +1300 Subject: [PATCH] add team to Client --- OpenRA.FileFormats/Session.cs | 1 + OpenRA.Game/Server/Server.cs | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/OpenRA.FileFormats/Session.cs b/OpenRA.FileFormats/Session.cs index e1eeccf68d..180848eb97 100644 --- a/OpenRA.FileFormats/Session.cs +++ b/OpenRA.FileFormats/Session.cs @@ -43,6 +43,7 @@ namespace OpenRA.FileFormats public int SpawnPoint; public string Name; public ClientState State; + public int Team; } public class Global diff --git a/OpenRA.Game/Server/Server.cs b/OpenRA.Game/Server/Server.cs index 5f8189067e..c9879ff5b9 100644 --- a/OpenRA.Game/Server/Server.cs +++ b/OpenRA.Game/Server/Server.cs @@ -148,7 +148,9 @@ namespace OpenRA.Server PaletteIndex = ChooseFreePalette(), Name = "Player {0}".F(1 + newConn.PlayerIndex), Country = "Random", - State = Session.ClientState.NotReady + State = Session.ClientState.NotReady, + SpawnPoint = 0, + Team = 0, }); Console.WriteLine("Client {0}: Accepted connection from {1}", @@ -324,6 +326,22 @@ namespace OpenRA.Server SyncLobbyInfo(); return true; }}, + { "team", + s => + { + if (GameStarted) + { + SendChatTo( conn, "You can't change your team after the game has started" ); + return true; + } + + int team; + if (!int.TryParse(s, out team)) { Console.WriteLine("Invalid team: {0}", s ); return false; } + + GetClient(conn).Team = team; + SyncLobbyInfo(); + return true; + }}, { "spawn", s => {