(svn r6786) -Codechange: To join a new company CMD_PLAYER_CTRL is executed with so far a
authorDarkvater
Sun, 15 Oct 2006 23:42:18 +0000
changeset 4860 217cdf845a12
parent 4859 78e6a7d0f490
child 4861 f28bfa84f9ad
(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
network_server.c
--- a/network_client.c	Sun Oct 15 23:37:15 2006 +0000
+++ b/network_client.c	Sun Oct 15 23:42:18 2006 +0000
@@ -521,9 +521,8 @@
 			} 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;
+				_local_player = PLAYER_SPECTATOR;
 				NetworkSend_Command(0, 0, 0, CMD_PLAYER_CTRL, NULL);
-				_local_player = PLAYER_SPECTATOR;
 			}
 		} else {
 			// take control over an existing company
--- a/network_server.c	Sun Oct 15 23:37:15 2006 +0000
+++ b/network_server.c	Sun Oct 15 23:42:18 2006 +0000
@@ -844,6 +844,7 @@
 		}
 
 		// XXX - UGLY! p2 is mis-used to get the client-id in CmdPlayerCtrl
+		cp->player = 0;
 		cp->p2 = cs - _clients;
 	}