Add: maximum number of companies allowed to the client list
This commit is contained in:
@@ -1111,6 +1111,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_CONFIG_UPDATE(P
|
||||
|
||||
_network_server_max_companies = p->Recv_uint8();
|
||||
_network_server_name = p->Recv_string(NETWORK_NAME_LENGTH);
|
||||
SetWindowClassesDirty(WC_CLIENT_LIST);
|
||||
|
||||
return NETWORK_RECV_STATUS_OKAY;
|
||||
}
|
||||
@@ -1319,11 +1320,20 @@ bool NetworkClientPreferTeamChat(const NetworkClientInfo *cio)
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the maximum number of companies that are allowed by the server.
|
||||
* @return The number of companies allowed.
|
||||
*/
|
||||
uint NetworkMaxCompaniesAllowed()
|
||||
{
|
||||
return _network_server ? _settings_client.network.max_companies : _network_server_max_companies;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if max_companies has been reached on the server (local check only).
|
||||
* @return true if the max value has been reached or exceeded, false otherwise.
|
||||
*/
|
||||
bool NetworkMaxCompaniesReached()
|
||||
{
|
||||
return Company::GetNumItems() >= (_network_server ? _settings_client.network.max_companies : _network_server_max_companies);
|
||||
return Company::GetNumItems() >= NetworkMaxCompaniesAllowed();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user