MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / SendCompanyUpdate

Method SendCompanyUpdate

src/network/network_admin.cpp:344–358  ·  view source on GitHub ↗

* Send an update about a company. * @param c The company to send the update of. */

Source from the content-addressed store, hash-verified

342 * @param c The company to send the update of.
343 */
344NetworkRecvStatus ServerNetworkAdminSocketHandler::SendCompanyUpdate(const Company *c)
345{
346 auto p = std::make_unique<Packet>(this, ADMIN_PACKET_SERVER_COMPANY_UPDATE);
347
348 p->Send_uint8 (c->index);
349 p->Send_string(GetString(STR_COMPANY_NAME, c->index));
350 p->Send_string(GetString(STR_PRESIDENT_NAME, c->index));
351 p->Send_uint8 (c->colour);
352 p->Send_bool (true);
353 p->Send_uint8 (CeilDiv(c->months_of_bankruptcy, 3)); // send as quarters_of_bankruptcy
354
355 this->SendPacket(std::move(p));
356
357 return NETWORK_RECV_STATUS_OKAY;
358}
359
360/**
361 * Tell the admin that a company got removed.

Callers 1

Calls 6

CeilDivFunction · 0.85
Send_stringMethod · 0.80
Send_boolMethod · 0.80
GetStringFunction · 0.50
Send_uint8Method · 0.45
SendPacketMethod · 0.45

Tested by

no test coverage detected