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

Function GetPackets

source/core/d_net.cpp:760–938  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

758//
759
760void GetPackets (void)
761{
762 int netconsole;
763 int netnode;
764 int realend;
765 int realstart;
766 int numtics;
767 int retransmitfrom;
768 int k;
769 uint8_t playerbytes[MAXNETNODES];
770 int numplayers;
771
772 while ( HGetPacket() )
773 {
774 if (netbuffer[0] & NCMD_SETUP)
775 {
776 if (myconnectindex == Net_Arbitrator)
777 {
778 // This player apparantly doesn't realise the game has started
779 netbuffer[0] = NCMD_SETUP+3;
780 HSendPacket (doomcom.remotenode, 1);
781 }
782 continue; // extra setup packet
783 }
784
785 netnode = doomcom.remotenode;
786 netconsole = playerfornode[netnode] & ~PL_DRONE;
787
788 // [RH] Get "ping" times - totally useless, since it's bound to the frequency
789 // packets go out at.
790 lastrecvtime[netconsole] = currrecvtime[netconsole];
791 currrecvtime[netconsole] = I_msTime ();
792
793 // check for exiting the game
794 if (netbuffer[0] & NCMD_EXIT)
795 {
796 if (!nodeingame[netnode])
797 continue;
798
799 if (NetMode != NET_PacketServer || netconsole == Net_Arbitrator)
800 {
801 PlayerIsGone (netnode, netconsole);
802 if (NetMode == NET_PacketServer)
803 {
804 uint8_t *foo = &netbuffer[2];
805 for (int i = 0; i < MAXPLAYERS; ++i)
806 {
807 if (playeringame[i])
808 {
809 int resend = ReadLong (&foo);
810 if (i != myconnectindex)
811 {
812 resendto[nodeforplayer[i]] = resend;
813 }
814 }
815 }
816 }
817 }

Callers 1

NetUpdateFunction · 0.85

Calls 8

HGetPacketFunction · 0.85
HSendPacketFunction · 0.85
I_msTimeFunction · 0.85
PlayerIsGoneFunction · 0.85
ReadLongFunction · 0.85
ExpandTicsFunction · 0.85
SkipTicCmdFunction · 0.85
ReadTicCmdFunction · 0.85

Tested by

no test coverage detected