|
@@ -331,31 +331,24 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER
|
|
|
char unique_id[NETWORK_NAME_LENGTH];
|
|
|
|
|
|
NetworkRecv_string(MY_CLIENT, p, name, sizeof(name));
|
|
|
NetworkRecv_string(MY_CLIENT, p, unique_id, sizeof(unique_id));
|
|
|
|
|
|
if (MY_CLIENT->quited)
|
|
|
return NETWORK_RECV_STATUS_CONN_LOST;
|
|
|
|
|
|
/* Do we receive a change of data? Most likely we changed playas */
|
|
|
if (index == _network_own_client_index) {
|
|
|
_network_playas = playas;
|
|
|
|
|
|
/* Are we a ai-network-client? Are we not joining as a SPECTATOR (playas == 0, means SPECTATOR) */
|
|
|
if (_ai.network_client && playas != 0) {
|
|
|
if (_ai.network_playas == PLAYER_SPECTATOR)
|
|
|
AI_StartNewAI(playas - 1);
|
|
|
|
|
|
_ai.network_playas = playas - 1;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
ci = NetworkFindClientInfoFromIndex(index);
|
|
|
if (ci != NULL) {
|
|
|
if (playas == ci->client_playas && strcmp(name, ci->client_name) != 0) {
|
|
|
// Client name changed, display the change
|
|
|
NetworkTextMessage(NETWORK_ACTION_NAME_CHANGE, 1, false, ci->client_name, "%s", name);
|
|
|
} else if (playas != ci->client_playas) {
|
|
|
// The player changed from client-player..
|
|
|
// Do not display that for now
|
|
|
}
|
|
|
|
|
@@ -531,35 +524,24 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER
|
|
|
_local_player = 0;
|
|
|
NetworkSend_Command(0, 0, 0, CMD_PLAYER_CTRL, NULL);
|
|
|
_local_player = PLAYER_SPECTATOR;
|
|
|
}
|
|
|
} else {
|
|
|
// take control over an existing company
|
|
|
_local_player = _network_playas - 1;
|
|
|
_patches.autorenew = GetPlayer(_local_player)->engine_renew;
|
|
|
_patches.autorenew_months = GetPlayer(_local_player)->engine_renew_months;
|
|
|
_patches.autorenew_money = GetPlayer(_local_player)->engine_renew_money;
|
|
|
DeleteWindowById(WC_NETWORK_STATUS_WINDOW, 0);
|
|
|
}
|
|
|
|
|
|
/* Check if we are an ai-network-client, and if so, disable GUI */
|
|
|
if (_ai.network_client) {
|
|
|
_ai.network_playas = _local_player;
|
|
|
_local_player = PLAYER_SPECTATOR;
|
|
|
|
|
|
if (_ai.network_playas != PLAYER_SPECTATOR) {
|
|
|
/* If we didn't join the game as a spectator, activate the AI */
|
|
|
AI_StartNewAI(_ai.network_playas);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return NETWORK_RECV_STATUS_OKAY;
|
|
|
}
|
|
|
|
|
|
DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_FRAME)
|
|
|
{
|
|
|
_frame_counter_server = NetworkRecv_uint32(MY_CLIENT, p);
|
|
|
_frame_counter_max = NetworkRecv_uint32(MY_CLIENT, p);
|
|
|
#ifdef ENABLE_NETWORK_SYNC_EVERY_FRAME
|
|
|
// Test if the server supports this option
|
|
|
// and if we are at the frame the server is
|