[raknet] Implement RakPeer::DeallocatePacket(...)

This commit is contained in:
RD42 2024-04-13 22:15:50 +08:00
parent cf9d90567c
commit 84aacf4165
4 changed files with 30 additions and 4 deletions

View File

@ -33,12 +33,20 @@ struct RAK_DLL_EXPORT PlayerID
/// This represents a user message from another system.
struct Packet
{
char _gap0[8];
/// The length of the data in bytes
/// \deprecated You should use bitSize.
unsigned int length;
char _gapC[4];
/// The data from the sender
unsigned char* data;
/// @internal
/// Indicates whether to delete the data, or to simply delete the packet.
bool deleteData;
};
struct RPCParameters

View File

@ -3,6 +3,7 @@
#include "RakPeer.h"
#include <string.h>
#include <stdlib.h>
RakPeer::RakPeer()
{
@ -158,9 +159,20 @@ void RakPeer::vftable_38()
// TODO: RakPeer::vftable_38() (saco W: 10040FD0) (server W: 458510 L: 806EA30) (bot W: 40BCE0 L: 8073806)
}
void RakPeer::vftable_3C()
// --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Description:
// Call this to deallocate a packet returned by Receive, in the same order returned to you from Receive
// --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
void RakPeer::DeallocatePacket( Packet *packet )
{
// TODO: RakPeer::vftable_3C() (saco W: 100385B0) (server W: 4500B0 L: 8071D60) (bot W: 404050 L: 80739A2)
if ( packet == 0 )
return;
if (packet->deleteData)
if (packet->data)
delete packet->data;
free(packet);
}
// --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@ -67,7 +67,10 @@ public:
void vftable_30();
void vftable_34();
void vftable_38();
void vftable_3C();
/// Call this to deallocate a message returned by Receive() when you are done handling it.
/// \param[in] packet The message to deallocate.
void DeallocatePacket( Packet *packet );
/// Return the total number of connections we are allowed
unsigned short GetMaximumNumberOfPeers( void ) const;

View File

@ -63,7 +63,10 @@ public:
virtual void vftable_30()=0;
virtual void vftable_34()=0;
virtual void vftable_38()=0;
virtual void vftable_3C()=0;
/// Call this to deallocate a message returned by Receive() when you are done handling it.
/// \param[in] packet The message to deallocate.
virtual void DeallocatePacket( Packet *packet )=0;
/// Return the total number of connections we are allowed
// TODO - rename for RakNet 3.0