diff options
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/network_client.cpp | 13 | ||||
-rw-r--r-- | src/network/network_func.h | 2 | ||||
-rw-r--r-- | src/network/network_server.cpp | 27 |
3 files changed, 17 insertions, 25 deletions
diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp index 810fdad95..dc4e46691 100644 --- a/src/network/network_client.cpp +++ b/src/network/network_client.cpp @@ -1029,6 +1029,19 @@ void NetworkClientRequestMove(CompanyID company_id, const char *pass) SEND_COMMAND(PACKET_CLIENT_MOVE)(company_id, pass); } +void NetworkClientsToSpectators(CompanyID cid) +{ + /* If our company is changing owner, go to spectators */ + if (cid == _local_company) SetLocalCompany(COMPANY_SPECTATOR); + + NetworkClientInfo *ci; + FOR_ALL_CLIENT_INFOS(ci) { + if (ci->client_playas != cid) continue; + NetworkTextMessage(NETWORK_ACTION_COMPANY_SPECTATOR, CC_DEFAULT, false, ci->client_name); + ci->client_playas = COMPANY_SPECTATOR; + } +} + void NetworkUpdateClientName() { NetworkClientInfo *ci = NetworkFindClientInfoFromClientID(_network_own_client_id); diff --git a/src/network/network_func.h b/src/network/network_func.h index afc24aeb8..72539e501 100644 --- a/src/network/network_func.h +++ b/src/network/network_func.h @@ -47,6 +47,7 @@ void NetworkStartDebugLog(NetworkAddress address); void NetworkPopulateCompanyStats(NetworkCompanyStats *stats); void NetworkUpdateClientInfo(ClientID client_id); +void NetworkClientsToSpectators(CompanyID cid); void NetworkClientConnectGame(NetworkAddress address, CompanyID join_as, const char *join_server_password = NULL, const char *join_company_password = NULL); void NetworkClientRequestMove(CompanyID company, const char *pass = ""); void NetworkClientSendRcon(const char *password, const char *command); @@ -61,7 +62,6 @@ void NetworkHandlePauseChange(PauseMode prev_mode, PauseMode changed_mode); /*** Commands ran by the server ***/ void NetworkServerMonthlyLoop(); void NetworkServerYearlyLoop(); -void NetworkServerChangeOwner(Owner current_owner, Owner new_owner); void NetworkServerSendConfigUpdate(); void NetworkServerShowStatusToConsole(); bool NetworkServerStart(); diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp index f4db459cb..b717395a7 100644 --- a/src/network/network_server.cpp +++ b/src/network/network_server.cpp @@ -1099,9 +1099,9 @@ void NetworkServerSendChat(NetworkAction action, DestType desttype, int dest, co } break; case DESTTYPE_TEAM: { - bool show_local = true; // If this is false, the message is already displayed - /* on the client who did sent it. - * Find all clients that belong to this company */ + /* If this is false, the message is already displayed on the client who sent it. */ + bool show_local = true; + /* Find all clients that belong to this company */ ci_to = NULL; FOR_ALL_CLIENT_SOCKETS(cs) { ci = cs->GetInfo(); @@ -1694,27 +1694,6 @@ void NetworkServerMonthlyLoop() NetworkAutoCleanCompanies(); } -void NetworkServerChangeOwner(Owner current_owner, Owner new_owner) -{ - /* The server has to handle all administrative issues, for example - * updating and notifying all clients of what has happened */ - NetworkClientInfo *ci = NetworkFindClientInfoFromClientID(CLIENT_ID_SERVER); - - /* The server has just changed from owner */ - if (current_owner == ci->client_playas) { - ci->client_playas = new_owner; - NetworkUpdateClientInfo(CLIENT_ID_SERVER); - } - - /* Find all clients that were in control of this company, and mark them as new_owner */ - FOR_ALL_CLIENT_INFOS(ci) { - if (current_owner == ci->client_playas) { - ci->client_playas = new_owner; - NetworkUpdateClientInfo(ci->client_id); - } - } -} - const char *GetClientIP(NetworkClientInfo *ci) { return ci->client_address.GetHostname(); |