MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / ServerSendTick

Method ServerSendTick

src/openrct2/network/NetworkBase.cpp:1589–1616  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1587 }
1588
1589 void NetworkBase::ServerSendTick()
1590 {
1591 Packet packet(Command::tick);
1592 packet << getGameState().currentTicks << ScenarioRandState().s0;
1593
1594 uint32_t flags = 0;
1595
1596 // Simple counter which limits how often a sprite checksum gets sent.
1597 // This can get somewhat expensive, so we don't want to push it every tick in release,
1598 // but debug version can check more often.
1599 static int32_t checksum_counter = 0;
1600 checksum_counter++;
1601 if (checksum_counter >= 100)
1602 {
1603 checksum_counter = 0;
1604 flags |= TickFlags::kChecksums;
1605 }
1606 // Send flags always, so we can understand packet structure on the other end,
1607 // and allow for some expansion.
1608 packet << flags;
1609 if (flags & TickFlags::kChecksums)
1610 {
1611 EntitiesChecksum checksum = getGameState().entities.GetAllEntitiesChecksum();
1612 packet.writeString(checksum.ToString());
1613 }
1614
1615 SendPacketToClients(packet);
1616 }
1617
1618 void NetworkBase::ServerSendPlayerInfo(int32_t playerId)
1619 {

Callers 1

SendTickFunction · 0.80

Calls 3

writeStringMethod · 0.45
ToStringMethod · 0.45

Tested by

no test coverage detected