Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.17 KB | None | 0 0
  1. bool Ghosting = true;
  2. int numberofpackets = 0;
  3. struct r3dNetPacketHeader
  4. {
  5.     int EventID;
  6.     //pseudo 2 stronk
  7. };
  8. struct PacketQueue
  9. {
  10.     r3dNetPacketHeader *packetData;
  11.     DWORD *PeerID;
  12.     int PacketSize;
  13. };
  14.  
  15. PacketQueue queue2stronk[512] = {0}; //Should not be more than 512 packets i guess.
  16.  
  17.  
  18. void QueuePackets(DWORD* PeerID, r3dNetPacketHeader* packetData, int packetSize)
  19. {
  20.     if(Ghosting)
  21.     {
  22.         if(queue2stronk[numberofpackets].PacketSize == 0)
  23.         {
  24.             queue2stronk[numberofpackets].PacketSize = packetSize;
  25.             queue2stronk[numberofpackets].PeerID = PeerID;
  26.             queue2stronk[numberofpackets].packetData = packetData;
  27.             numberofpackets ++;
  28.         }
  29.         else
  30.         {
  31.             queue2stronk[numberofpackets+1].PacketSize = packetSize;
  32.             queue2stronk[numberofpackets+1].PeerID = PeerID;
  33.             queue2stronk[numberofpackets+1].packetData = packetData;
  34.             numberofpackets += 2;
  35.         }
  36.     }
  37.     else
  38.     {
  39.         if(numberofpackets > 0)
  40.         {
  41.             numberofpackets = 0;
  42.             for(int x; x < 512; x++)
  43.             {
  44.                 if(queue2stronk[x].PacketSize > 0)
  45.                 {
  46.                     //SendThePacket
  47.                     //Set it to 0
  48.                     queue2stronk[x].PacketSize = 0;
  49.                 }
  50.             }
  51.         }
  52.         //Send the packet that was passed on to the function
  53.     }
  54.  
  55.  
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement