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

Function reportPacketProgress

src/openrct2/network/NetworkBase.cpp:1769–1798  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1767 }
1768
1769 static void reportPacketProgress(NetworkBase& network, Connection& connection)
1770 {
1771 if (network.GetMode() != Mode::client)
1772 {
1773 return;
1774 }
1775
1776 const auto nextPacketCommand = connection.getPendingPacketCommand();
1777 const auto bytesReceived = connection.getPendingPacketAvailable();
1778 const auto bytesTotal = connection.getPendingPacketSize();
1779
1780 switch (nextPacketCommand)
1781 {
1782 case Command::objectsList:
1783 displayNetworkProgress(STR_MULTIPLAYER_RECEIVING_OBJECTS_LIST);
1784 break;
1785 case Command::map:
1786 displayNetworkProgress(STR_MULTIPLAYER_DOWNLOADING_MAP);
1787 break;
1788 case Command::scriptsData:
1789 displayNetworkProgress(STR_MULTIPLAYER_RECEIVING_SCRIPTS);
1790 break;
1791 default:
1792 // Nothing to report.
1793 return;
1794 }
1795
1796 network.GetContext().SetProgress(
1797 static_cast<uint32_t>(bytesReceived / 1024), static_cast<uint32_t>(bytesTotal / 1024), STR_STRING_M_OF_N_KIB);
1798 }
1799
1800 bool NetworkBase::ProcessConnection(Connection& connection)
1801 {

Callers 1

ProcessConnectionMethod · 0.85

Calls 7

displayNetworkProgressFunction · 0.85
GetModeMethod · 0.80
getPendingPacketSizeMethod · 0.80
SetProgressMethod · 0.80
GetContextMethod · 0.45

Tested by

no test coverage detected