Fix Selecting a map resets player color

This commit is contained in:
rob-v
2017-04-27 11:04:54 +02:00
committed by Paul Chote
parent d95bb4152a
commit b2e6a0484b
2 changed files with 3 additions and 2 deletions

View File

@@ -95,7 +95,8 @@ namespace OpenRA.Graphics
public static bool operator ==(HSLColor me, HSLColor other) public static bool operator ==(HSLColor me, HSLColor other)
{ {
return me.H == other.H && me.S == other.S && me.L == other.L; // Binary floating point numbers (float, double) calculations can yield the same RGB color created by different functions with little different HSL representation
return (me.H == other.H && me.S == other.S && me.L == other.L) || me.RGB == other.RGB;
} }
public static bool operator !=(HSLColor me, HSLColor other) { return !(me == other); } public static bool operator !=(HSLColor me, HSLColor other) { return !(me == other); }

View File

@@ -306,7 +306,7 @@ namespace OpenRA.Server
IpAddress = ((IPEndPoint)newConn.Socket.RemoteEndPoint).Address.ToString(), IpAddress = ((IPEndPoint)newConn.Socket.RemoteEndPoint).Address.ToString(),
Index = newConn.PlayerIndex, Index = newConn.PlayerIndex,
Slot = LobbyInfo.FirstEmptySlot(), Slot = LobbyInfo.FirstEmptySlot(),
PreferredColor = handshake.Client.Color, PreferredColor = handshake.Client.PreferredColor,
Color = handshake.Client.Color, Color = handshake.Client.Color,
Faction = "Random", Faction = "Random",
SpawnPoint = 0, SpawnPoint = 0,