Ejemplo n.º 1
0
UDPpacket* network_packet_resize(UDPpacket* packet, int size) {
        int newsize = SDLNet_ResizePacket(packet, size);
        if (newsize < size) {
                std::cerr << "Failed to resize UDP packet: " << SDLNet_GetError() << "\n";
                return NULL;
        }
        return packet;
}
Ejemplo n.º 2
0
/*
* network_packet_resize() - Resize the packet data to the given size
* @packet: the packet to resize
* @size: the new size of the packet
*/
UDPpacket* network_packet_resize(UDPpacket* packet, int size) {
	int newsize = 0; // Define the resultant size of the packet

	newsize = SDLNet_ResizePacket(packet, size); // Attempt to resize the packet
	if (newsize < size) { // If the packet could not be resized
		std::cerr << "Failed to resize UDP packet: " << SDLNet_GetError() << "\n"; // Output the error message
		return nullptr; // Return nullptr on failure
	}

	return packet; // Return the packet pointer on success
}
Ejemplo n.º 3
0
int UdpSocket::Resize(int pSize)
{
    return mSize = SDLNet_ResizePacket(mPacket, pSize);
}