Fix most of the player color regressions

This commit is contained in:
Paul Chote
2010-02-04 23:54:16 +13:00
parent 6c99b33364
commit 2a7f52edc7
7 changed files with 69 additions and 47 deletions

View File

@@ -58,13 +58,16 @@ namespace OpenRA.Server
throw new InvalidOperationException("Already got 8 players");
}
static string ChooseFreePalette()
static int ChooseFreePalette()
{
// TODO: FIX
// TODO: Query the list of palettes from somewhere, and pick one
return 0;
/*
for (var i = 0; i < 8; i++)
//if (lobbyInfo.Clients.All(c => c.Palette != i))
if (lobbyInfo.Clients.All(c => c.Palette != i))
return "player"+i;
*/
throw new InvalidOperationException("No free palettes");
}
@@ -86,7 +89,7 @@ namespace OpenRA.Server
new Session.Client()
{
Index = newConn.PlayerIndex,
Palette = ChooseFreePalette(),
PaletteIndex = ChooseFreePalette(),
Name = "Player {0}".F(1 + newConn.PlayerIndex),
Race = 1,
State = Session.ClientState.NotReady
@@ -255,15 +258,14 @@ namespace OpenRA.Server
Console.WriteLine("Invalid palette: {0}", s);
return false;
}
string pal = "player"+pali;
if (lobbyInfo.Clients.Where( c => c != GetClient(conn) ).Any( c => c.Palette == pal ))
if (lobbyInfo.Clients.Where( c => c != GetClient(conn) ).Any( c => c.PaletteIndex == pali ))
{
SendChatTo( conn, "You can't be the same color as another player" );
return true;
}
GetClient(conn).Palette = pal;
GetClient(conn).PaletteIndex = pali;
SyncLobbyInfo();
return true;
}},