MCPcopy Create free account
hub / github.com/ZDoom/Raze / D_QuitNetGame

Function D_QuitNetGame

source/core/d_net.cpp:1770–1813  ·  view source on GitHub ↗

D_QuitNetGame Called before quitting to leave a net game without hanging the other players

Source from the content-addressed store, hash-verified

1768// without hanging the other players
1769//
1770void D_QuitNetGame (void)
1771{
1772 int i, j, k;
1773
1774 if (!netgame || !usergame || myconnectindex == -1 || demoplayback)
1775 return;
1776
1777 // send a bunch of packets for security
1778 netbuffer[0] = NCMD_EXIT;
1779 netbuffer[1] = 0;
1780
1781 k = 2;
1782 if (NetMode == NET_PacketServer && myconnectindex == Net_Arbitrator)
1783 {
1784 uint8_t *foo = &netbuffer[2];
1785
1786 // Let the new arbitrator know what resendto counts to use
1787
1788 for (i = 0; i < MAXPLAYERS; ++i)
1789 {
1790 if (playeringame[i] && i != myconnectindex)
1791 WriteLong (resendto[nodeforplayer[i]], &foo);
1792 }
1793 k = int(foo - netbuffer);
1794 }
1795
1796 for (i = 0; i < 4; i++)
1797 {
1798 if (NetMode == NET_PacketServer && myconnectindex != Net_Arbitrator)
1799 {
1800 HSendPacket (nodeforplayer[Net_Arbitrator], 2);
1801 }
1802 else
1803 {
1804 for (j = 1; j < doomcom.numnodes; j++)
1805 if (nodeingame[j])
1806 HSendPacket (j, k);
1807 }
1808 I_WaitVBL (1);
1809 }
1810
1811 if (debugfile)
1812 fclose (debugfile);
1813}
1814
1815
1816void Net_CheckLastReceived (int counts)

Callers

nothing calls this directly

Calls 3

WriteLongFunction · 0.85
HSendPacketFunction · 0.85
I_WaitVBLFunction · 0.85

Tested by

no test coverage detected