Extendable palette definitions. Contains many regressions, bugs and general hacks

This commit is contained in:
Paul Chote
2010-02-03 23:32:25 +13:00
parent 1e01911b46
commit 6821238710
40 changed files with 311 additions and 160 deletions

View File

@@ -58,11 +58,12 @@ namespace OpenRA.Server
throw new InvalidOperationException("Already got 8 players");
}
static int ChooseFreePalette()
static string ChooseFreePalette()
{
// TODO: FIX
for (var i = 0; i < 8; i++)
if (lobbyInfo.Clients.All(c => c.Palette != i))
return i;
//if (lobbyInfo.Clients.All(c => c.Palette != i))
return "player"+i;
throw new InvalidOperationException("No free palettes");
}
@@ -247,14 +248,15 @@ namespace OpenRA.Server
SendChatTo( conn, "You can't change your color after the game has started" );
return true;
}
int pal;
if (!int.TryParse(s, out pal) || pal < 0 || pal > 7)
int pali;
if (!int.TryParse(s, out pali) || pali < 0 || pali > 7)
{
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 ))
{
SendChatTo( conn, "You can't be the same color as another player" );