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

Function HGetPacket

source/core/d_net.cpp:557–673  ·  view source on GitHub ↗

HGetPacket Returns false if no packet is waiting

Source from the content-addressed store, hash-verified

555// Returns false if no packet is waiting
556//
557bool HGetPacket (void)
558{
559 if (reboundpacket)
560 {
561 memcpy (netbuffer, reboundstore, reboundpacket);
562 doomcom.remotenode = 0;
563 reboundpacket = 0;
564 return true;
565 }
566
567 if (!netgame)
568 return false;
569
570 if (demoplayback)
571 return false;
572
573 doomcom.command = CMD_GET;
574 I_NetCmd ();
575
576#ifdef _DEBUG
577 if (net_fakelatency / 2 > 0 && doomcom.remotenode != -1)
578 {
579 PacketStore store;
580 store.message = doomcom;
581 store.timer = I_GetTime() + ((net_fakelatency / 2) / (1000 / GameTicRate));
582 InBuffer.Push(store);
583 doomcom.remotenode = -1;
584 }
585
586 if (doomcom.remotenode == -1)
587 {
588 bool gotmessage = false;
589 for (unsigned int i = 0; i < InBuffer.Size(); i++)
590 {
591 if (InBuffer[i].timer <= I_GetTime())
592 {
593 doomcom = InBuffer[i].message;
594 InBuffer.Delete(i);
595 gotmessage = true;
596 break;
597 }
598 }
599 if (!gotmessage)
600 return false;
601 }
602#else
603 if (doomcom.remotenode == -1)
604 {
605 return false;
606 }
607#endif
608
609 if (debugfile)
610 {
611 int i, k, realretrans;
612
613 if (netbuffer[0] & NCMD_SETUP)
614 {

Callers 2

GetPacketsFunction · 0.85
DoArbitrateFunction · 0.85

Calls 8

I_NetCmdFunction · 0.85
I_GetTimeFunction · 0.85
ExpandTicsFunction · 0.85
NetbufferSizeFunction · 0.85
PrintfFunction · 0.85
PushMethod · 0.45
SizeMethod · 0.45
DeleteMethod · 0.45

Tested by

no test coverage detected