added protocol versioning. AssignPlayer order is dead.

This commit is contained in:
Chris Forbes
2010-01-25 18:29:56 +13:00
parent 0998e1f17b
commit be8bb20e82
7 changed files with 35 additions and 23 deletions

View File

@@ -5,6 +5,7 @@ using System.Text;
using System.Net.Sockets;
using System.Threading;
using System.IO;
using OpenRa.FileFormats;
namespace OpenRa.Network
{
@@ -78,6 +79,13 @@ namespace OpenRa.Network
{
socket = new TcpClient( host, port );
var reader = new BinaryReader( socket.GetStream() );
var serverProtocol = reader.ReadInt32();
if (ProtocolVersion.Version != serverProtocol)
throw new InvalidOperationException(
"Protocol version mismatch. Server={0} Client={1}"
.F(serverProtocol, ProtocolVersion.Version));
clientId = reader.ReadInt32();
connectionState = ConnectionState.Connected;

View File

@@ -18,12 +18,6 @@ namespace OpenRa.Network
Game.chat.AddLine(order.Player, order.TargetString);
break;
}
case "AssignPlayer":
{
order.Player.World.LocalPlayer = order.Player;
Game.chat.AddLine(order.Player, "is now YOU.");
break;
}
case "StartGame":
{
Game.chat.AddLine(Color.White, "Server", "The game has started.");