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

Method SendFrame

src/network/network_server.cpp:616–636  ·  view source on GitHub ↗

Tell the client that they may run to a particular frame. */

Source from the content-addressed store, hash-verified

614
615/** Tell the client that they may run to a particular frame. */
616NetworkRecvStatus ServerNetworkGameSocketHandler::SendFrame()
617{
618 auto p = std::make_unique<Packet>(this, PACKET_SERVER_FRAME);
619 p->Send_uint32(_frame_counter);
620 p->Send_uint32(_frame_counter_max);
621#ifdef ENABLE_NETWORK_SYNC_EVERY_FRAME
622 p->Send_uint32(_sync_seed_1);
623#ifdef NETWORK_SEND_DOUBLE_SEED
624 p->Send_uint32(_sync_seed_2);
625#endif
626#endif
627
628 /* If token equals 0, we need to make a new token and send that. */
629 if (this->last_token == 0) {
630 this->last_token = InteractiveRandomRange(UINT8_MAX - 1) + 1;
631 p->Send_uint8(this->last_token);
632 }
633
634 this->SendPacket(std::move(p));
635 return NETWORK_RECV_STATUS_OKAY;
636}
637
638/** Request the client to sync. */
639NetworkRecvStatus ServerNetworkGameSocketHandler::SendSync()

Callers 2

Receive_CLIENT_MAP_OKMethod · 0.95
NetworkServer_TickFunction · 0.80

Calls 4

InteractiveRandomRangeFunction · 0.85
Send_uint32Method · 0.80
Send_uint8Method · 0.45
SendPacketMethod · 0.45

Tested by

no test coverage detected