network_server.c
changeset 4861 f28bfa84f9ad
parent 4860 217cdf845a12
child 4878 744717de172e
--- a/network_server.c	Sun Oct 15 23:42:18 2006 +0000
+++ b/network_server.c	Sun Oct 15 23:48:34 2006 +0000
@@ -596,7 +596,7 @@
 
 	// join another company does not affect these values
 	switch (playas) {
-		case 0: /* New company */
+		case PLAYER_NEW_COMPANY: /* New company */
 			if (ActivePlayerCount() >= _network_game_info.companies_max) {
 				SEND_COMMAND(PACKET_SERVER_ERROR)(cs, NETWORK_ERROR_FULL);
 				return;
@@ -608,6 +608,12 @@
 				return;
 			}
 			break;
+		default: /* Join another company (companies 1-8) */
+			if (!IsValidPlayer(playas - 1)) {
+				SEND_COMMAND(PACKET_SERVER_ERROR)(cs, NETWORK_ERROR_PLAYER_MISMATCH);
+				return;
+			}
+			break;
 	}
 
 	// We need a valid name.. make it Player