From 7cac86186e8333fc98d2cd7eb863c6a7e5a58378 Mon Sep 17 00:00:00 2001 From: Darkvater Date: Sun, 15 Oct 2006 23:42:18 +0000 Subject: [PATCH] (svn r6786) -Codechange: To join a new company CMD_PLAYER_CTRL is executed with so far a local spectator (awaiting assignment from server). Since a spectator cannot execute any commands, a local player is impersonated. Move this impersonation to the server side where CMD_PLAYER_CTRL is handled specially anyways. --- network_client.c | 3 +-- network_server.c | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/network_client.c b/network_client.c index 8f6379a674..836c0611d9 100644 --- a/network_client.c +++ b/network_client.c @@ -521,9 +521,8 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_MAP) } else { /* We have arrived and ready to start playing; send a command to make a new player; * the server will give us a client-id and let us in */ - _local_player = 0; - NetworkSend_Command(0, 0, 0, CMD_PLAYER_CTRL, NULL); _local_player = PLAYER_SPECTATOR; + NetworkSend_Command(0, 0, 0, CMD_PLAYER_CTRL, NULL); } } else { // take control over an existing company diff --git a/network_server.c b/network_server.c index e64f723e3e..51c11ba838 100644 --- a/network_server.c +++ b/network_server.c @@ -844,6 +844,7 @@ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_COMMAND) } // XXX - UGLY! p2 is mis-used to get the client-id in CmdPlayerCtrl + cp->player = 0; cp->p2 = cs - _clients; }