1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-18 18:02:37 +01:00

Codechange: use ReferenceThroughBaseContainer for containers that are index by CompanyID

This commit is contained in:
Rubidium
2025-02-10 18:03:01 +01:00
committed by rubidium42
parent 1ffc950e22
commit 5401ab1f7b
13 changed files with 23 additions and 20 deletions

View File

@@ -1485,12 +1485,11 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_MOVE(Packet &p)
}
/**
* Populate the company stats.
* @param stats the stats to update
* Get the company stats.
*/
void NetworkPopulateCompanyStats(NetworkCompanyStats *stats)
NetworkCompanyStatsArray NetworkGetCompanyStats()
{
memset(stats, 0, sizeof(*stats) * MAX_COMPANIES);
NetworkCompanyStatsArray stats = {};
/* Go through all vehicles and count the type of vehicles */
for (const Vehicle *v : Vehicle::Iterate()) {
@@ -1518,6 +1517,8 @@ void NetworkPopulateCompanyStats(NetworkCompanyStats *stats)
if (s->facilities.Test(StationFacility::Dock)) npi->num_station[NETWORK_VEH_SHIP]++;
}
}
return stats;
}
/**