network_client.c
branch0.5
changeset 5370 fb39e4250252
parent 5296 6a4aaa66eed3
child 5407 e354823cde11
child 5568 75f13d7bfaed
equal deleted inserted replaced
5369:4363e2fc3e4a 5370:fb39e4250252
   507 		/* New company/spectator (invalid player) or company we want to join is not active
   507 		/* New company/spectator (invalid player) or company we want to join is not active
   508 		 * Switch local player to spectator and await the server's judgement */
   508 		 * Switch local player to spectator and await the server's judgement */
   509 		if (_network_playas == PLAYER_NEW_COMPANY || !IsValidPlayer(_network_playas) ||
   509 		if (_network_playas == PLAYER_NEW_COMPANY || !IsValidPlayer(_network_playas) ||
   510 				!GetPlayer(_network_playas)->is_active) {
   510 				!GetPlayer(_network_playas)->is_active) {
   511 
   511 
   512 			_local_player = PLAYER_SPECTATOR;
   512 			SetLocalPlayer(PLAYER_SPECTATOR);
   513 
   513 
   514 			if (_network_playas == PLAYER_SPECTATOR) {
   514 			if (_network_playas == PLAYER_SPECTATOR) {
   515 				// The client wants to be a spectator..
   515 				// The client wants to be a spectator..
   516 				DeleteWindowById(WC_NETWORK_STATUS_WINDOW, 0);
   516 				DeleteWindowById(WC_NETWORK_STATUS_WINDOW, 0);
   517 			} else {
   517 			} else {
   519 				 * the server will give us a client-id and let us in */
   519 				 * the server will give us a client-id and let us in */
   520 				NetworkSend_Command(0, 0, 0, CMD_PLAYER_CTRL, NULL);
   520 				NetworkSend_Command(0, 0, 0, CMD_PLAYER_CTRL, NULL);
   521 			}
   521 			}
   522 		} else {
   522 		} else {
   523 			// take control over an existing company
   523 			// take control over an existing company
   524 			_local_player = _network_playas;
   524 			SetLocalPlayer(_network_playas);
   525 			_patches.autorenew = GetPlayer(_local_player)->engine_renew;
       
   526 			_patches.autorenew_months = GetPlayer(_local_player)->engine_renew_months;
       
   527 			_patches.autorenew_money = GetPlayer(_local_player)->engine_renew_money;
       
   528 			DeleteWindowById(WC_NETWORK_STATUS_WINDOW, 0);
   525 			DeleteWindowById(WC_NETWORK_STATUS_WINDOW, 0);
   529 		}
   526 		}
   530 	}
   527 	}
   531 
   528 
   532 	return NETWORK_RECV_STATUS_OKAY;
   529 	return NETWORK_RECV_STATUS_OKAY;