diff -r 6f67fcf73873 -r 8aba54c245cc network_client.c --- a/network_client.c Tue Nov 22 14:02:45 2005 +0000 +++ b/network_client.c Tue Nov 22 15:55:38 2005 +0000 @@ -19,6 +19,7 @@ #include "settings.h" #include "console.h" #include "variables.h" +#include "ai/ai.h" // This file handles all the client-commands @@ -342,9 +343,18 @@ return NETWORK_RECV_STATUS_CONN_LOST; /* Do we receive a change of data? Most likely we changed playas */ - if (index == _network_own_client_index) + if (index == _network_own_client_index) { _network_playas = playas; + /* Are we a ai-network-client? */ + if (_ai.network_client) { + if (_ai.network_playas == OWNER_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) { @@ -532,6 +542,17 @@ _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 = OWNER_SPECTATOR; + + if (_ai.network_playas != OWNER_SPECTATOR) { + /* If we didn't join the game as a spectator, activate the AI */ + AI_StartNewAI(_ai.network_playas); + } + } } return NETWORK_RECV_STATUS_OKAY;