add team to Client

This commit is contained in:
Chris Forbes
2010-03-19 18:38:23 +13:00
parent 793a337797
commit 7a16c40eda
2 changed files with 20 additions and 1 deletions

View File

@@ -43,6 +43,7 @@ namespace OpenRA.FileFormats
public int SpawnPoint;
public string Name;
public ClientState State;
public int Team;
}
public class Global

View File

@@ -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 =>
{