summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-05-22 15:23:47 +0000
committersmatz <smatz@openttd.org>2009-05-22 15:23:47 +0000
commit10d1ef5447b94d17024dc0f4bdd1b7b017431a23 (patch)
treea9563d19933124547ccd3d6c0e53c44876bdc144 /src/network
parent62a7948af0ca9eb3b190a54918201e1075edcbbc (diff)
downloadopenttd-10d1ef5447b94d17024dc0f4bdd1b7b017431a23.tar.xz
(svn r16379) -Codechange: remove GetNumTowns(), GetNumIndustries() and GetActiveCompanyCount(), use PoolItem::GetNumItems() instead
Diffstat (limited to 'src/network')
-rw-r--r--src/network/network_client.cpp2
-rw-r--r--src/network/network_server.cpp4
-rw-r--r--src/network/network_udp.cpp4
3 files changed, 5 insertions, 5 deletions
diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp
index 5705fec41..e31ecc6bc 100644
--- a/src/network/network_client.cpp
+++ b/src/network/network_client.cpp
@@ -1021,7 +1021,7 @@ bool NetworkClientPreferTeamChat(const NetworkClientInfo *cio)
*/
bool NetworkMaxCompaniesReached()
{
- return ActiveCompanyCount() >= (_network_server ? _settings_client.network.max_companies : _network_server_max_companies);
+ return Company::GetNumItems() >= (_network_server ? _settings_client.network.max_companies : _network_server_max_companies);
}
/**
diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp
index e48137547..2ccd5c625 100644
--- a/src/network/network_server.cpp
+++ b/src/network/network_server.cpp
@@ -674,7 +674,7 @@ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_JOIN)
/* join another company does not affect these values */
switch (playas) {
case COMPANY_NEW_COMPANY: // New company
- if (ActiveCompanyCount() >= _settings_client.network.max_companies) {
+ if (Company::GetNumItems() >= _settings_client.network.max_companies) {
SEND_COMMAND(PACKET_SERVER_ERROR)(cs, NETWORK_ERROR_FULL);
return;
}
@@ -901,7 +901,7 @@ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_COMMAND)
}
/* Check if we are full - else it's possible for spectators to send a CMD_COMPANY_CTRL and the company is created regardless of max_companies! */
- if (ActiveCompanyCount() >= _settings_client.network.max_companies) {
+ if (Company::GetNumItems() >= _settings_client.network.max_companies) {
NetworkServerSendChat(NETWORK_ACTION_SERVER_MESSAGE, DESTTYPE_CLIENT, ci->client_id, "cannot create new company, server full", CLIENT_ID_SERVER);
return;
}
diff --git a/src/network/network_udp.cpp b/src/network/network_udp.cpp
index 54b24e6b7..7eaf19397 100644
--- a/src/network/network_udp.cpp
+++ b/src/network/network_udp.cpp
@@ -95,7 +95,7 @@ DEF_UDP_RECEIVE_COMMAND(Server, PACKET_UDP_CLIENT_FIND_SERVER)
ngi.server_lang = _settings_client.network.server_lang;
ngi.use_password = !StrEmpty(_settings_client.network.server_password);
ngi.clients_max = _settings_client.network.max_clients;
- ngi.companies_on = ActiveCompanyCount();
+ ngi.companies_on = (byte)Company::GetNumItems();
ngi.companies_max = _settings_client.network.max_companies;
ngi.spectators_on = NetworkSpectatorCount();
ngi.spectators_max = _settings_client.network.max_spectators;
@@ -128,7 +128,7 @@ DEF_UDP_RECEIVE_COMMAND(Server, PACKET_UDP_CLIENT_DETAIL_INFO)
/* Send the amount of active companies */
packet.Send_uint8 (NETWORK_COMPANY_INFO_VERSION);
- packet.Send_uint8 (ActiveCompanyCount());
+ packet.Send_uint8 ((uint8)Company::GetNumItems());
/* Fetch the latest version of the stats */
NetworkCompanyStats company_stats[MAX_COMPANIES];