Fixed crash on large palette indexes.

This commit is contained in:
Matthew Bowra-Dean
2010-03-27 23:16:16 +13:00
parent 006ccbc59c
commit c512626ab0
3 changed files with 4 additions and 4 deletions

View File

@@ -512,7 +512,7 @@ namespace OpenRA
paletteRect.Top + Game.viewport.Location.Y + 5, paletteRect.Top + Game.viewport.Location.Y + 5,
paletteRect.Right + Game.viewport.Location.X - 5, paletteRect.Right + Game.viewport.Location.X - 5,
paletteRect.Bottom+Game.viewport.Location.Y - 5), paletteRect.Bottom+Game.viewport.Location.Y - 5),
Player.PlayerColors[client.PaletteIndex].c); Player.PlayerColors[client.PaletteIndex % Player.PlayerColors.Count()].c);
lineRenderer.Flush(); lineRenderer.Flush();
f.DrawText(rgbaRenderer, client.Country, new int2(r.Left + 220, y), Color.White); f.DrawText(rgbaRenderer, client.Country, new int2(r.Left + 220, y), Color.White);
f.DrawText(rgbaRenderer, client.State.ToString(), new int2(r.Left + 290, y), Color.White); f.DrawText(rgbaRenderer, client.State.ToString(), new int2(r.Left + 290, y), Color.White);

View File

@@ -194,7 +194,7 @@ namespace OpenRA.Graphics
lineRenderer.FillRect(new RectangleF( lineRenderer.FillRect(new RectangleF(
Game.viewport.Location.X + pos.X + 2, Game.viewport.Location.X + pos.X + 2,
Game.viewport.Location.Y + pos.Y + 2, Game.viewport.Location.Y + pos.Y + 2,
12, 12), Player.PlayerColors[ p.Second.PaletteIndex ].c); 12, 12), Player.PlayerColors[ p.Second.PaletteIndex % Player.PlayerColors.Count() ].c);
rgbaRenderer.DrawSprite(ownedSpawnPoint, pos, "chrome"); rgbaRenderer.DrawSprite(ownedSpawnPoint, pos, "chrome");
} }

View File

@@ -73,8 +73,8 @@ namespace OpenRA
if (client != null) if (client != null)
{ {
Index = client.Index; Index = client.Index;
Palette = PlayerColors[client.PaletteIndex].a; Palette = PlayerColors[client.PaletteIndex % PlayerColors.Count()].a;
Color = PlayerColors[client.PaletteIndex].c; Color = PlayerColors[client.PaletteIndex % PlayerColors.Count()].c;
PlayerName = client.Name; PlayerName = client.Name;
InternalName = "Multi{0}".F(client.Index); InternalName = "Multi{0}".F(client.Index);
} }