fix all the buggy crap around chat/teamchat... still hacked
This commit is contained in:
@@ -16,10 +16,13 @@ namespace OpenRA.Network
|
|||||||
{
|
{
|
||||||
static class UnitOrders
|
static class UnitOrders
|
||||||
{
|
{
|
||||||
static Player FindPlayerByClientId( this World world, int id)
|
static Player FindPlayerByClient( this World world, Session.Client c)
|
||||||
{
|
{
|
||||||
/* todo: find the interactive player. */
|
/* todo: this is still a hack.
|
||||||
return world.players.Values.FirstOrDefault(p => p.ClientIndex == id);
|
* the cases we're trying to avoid are the extra players on the host's client -- Neutral, other MapPlayers,
|
||||||
|
* bots,.. */
|
||||||
|
return world.players.Values.FirstOrDefault(
|
||||||
|
p => p.ClientIndex == c.Index && p.PlayerName == c.Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ProcessOrder( OrderManager orderManager, World world, int clientId, Order order )
|
public static void ProcessOrder( OrderManager orderManager, World world, int clientId, Order order )
|
||||||
@@ -36,10 +39,14 @@ namespace OpenRA.Network
|
|||||||
case "Chat":
|
case "Chat":
|
||||||
{
|
{
|
||||||
var client = orderManager.LobbyInfo.ClientWithIndex( clientId );
|
var client = orderManager.LobbyInfo.ClientWithIndex( clientId );
|
||||||
if( client != null )
|
if (client != null)
|
||||||
Game.AddChatLine( client.Color1, client.Name, order.TargetString );
|
{
|
||||||
|
var player = world != null ? world.FindPlayerByClient(client) : null;
|
||||||
|
var suffix = (player != null && player.WinState == WinState.Lost) ? " (Dead)" : "";
|
||||||
|
Game.AddChatLine(client.Color1, client.Name, order.TargetString);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
Game.AddChatLine( Color.White, "(player {0})".F( clientId ), order.TargetString );
|
Game.AddChatLine(Color.White, "(player {0})".F(clientId), order.TargetString);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "TeamChat":
|
case "TeamChat":
|
||||||
@@ -47,9 +54,15 @@ namespace OpenRA.Network
|
|||||||
var client = orderManager.LobbyInfo.ClientWithIndex(clientId);
|
var client = orderManager.LobbyInfo.ClientWithIndex(clientId);
|
||||||
if (client != null)
|
if (client != null)
|
||||||
{
|
{
|
||||||
if (world != null) // TODO: fix this whole thing properly. this is BS.
|
if (world == null)
|
||||||
{
|
{
|
||||||
var player = world.FindPlayerByClientId(clientId);
|
if (client.Team == orderManager.LocalClient.Team)
|
||||||
|
Game.AddChatLine(client.Color1, client.Name + " (Team)",
|
||||||
|
order.TargetString);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var player = world.FindPlayerByClient(client);
|
||||||
var display = player != null
|
var display = player != null
|
||||||
&& (world.LocalPlayer != null && player.Stances[world.LocalPlayer] == Stance.Ally
|
&& (world.LocalPlayer != null && player.Stances[world.LocalPlayer] == Stance.Ally
|
||||||
|| player.WinState == WinState.Lost);
|
|| player.WinState == WinState.Lost);
|
||||||
|
|||||||
Reference in New Issue
Block a user