Send statistics about the companies. */
| 407 | |
| 408 | /** Send statistics about the companies. */ |
| 409 | NetworkRecvStatus ServerNetworkAdminSocketHandler::SendCompanyStats() |
| 410 | { |
| 411 | /* Fetch the latest version of the stats. */ |
| 412 | NetworkCompanyStatsArray company_stats = NetworkGetCompanyStats(); |
| 413 | |
| 414 | /* Go through all the companies. */ |
| 415 | for (const Company *company : Company::Iterate()) { |
| 416 | auto p = std::make_unique<Packet>(this, ADMIN_PACKET_SERVER_COMPANY_STATS); |
| 417 | |
| 418 | /* Send the information. */ |
| 419 | p->Send_uint8(company->index); |
| 420 | |
| 421 | for (uint i = 0; i < NETWORK_VEH_END; i++) { |
| 422 | p->Send_uint16(company_stats[company->index].num_vehicle[i]); |
| 423 | } |
| 424 | |
| 425 | for (uint i = 0; i < NETWORK_VEH_END; i++) { |
| 426 | p->Send_uint16(company_stats[company->index].num_station[i]); |
| 427 | } |
| 428 | |
| 429 | this->SendPacket(std::move(p)); |
| 430 | } |
| 431 | |
| 432 | return NETWORK_RECV_STATUS_OKAY; |
| 433 | } |
| 434 | |
| 435 | /** |
| 436 | * Send a chat message. |
no test coverage detected