FastEngine 0.9.3
A multiplayer oriented 2D engine made with Vulkan.
Loading...
Searching...
No Matches
fge::net::TransmissionPacket Struct Reference

A packet with configurable options to transmit via a network thread. More...

#include <C_client.hpp>

Classes

struct  Option
 

Public Types

enum class  Options { UPDATE_TIMESTAMP , UPDATE_FULL_TIMESTAMP , UPDATE_CORRECTION_LATENCY }
 Options to pass to the network thread when sending a packet. More...
 

Public Member Functions

 TransmissionPacket (TransmissionPacket const &r)=delete
 
 TransmissionPacket (TransmissionPacket &&r) noexcept=delete
 
TransmissionPacketoperator= (TransmissionPacket const &r)=delete
 
TransmissionPacketoperator= (TransmissionPacket &&r) noexcept=delete
 
ProtocolPacket const & packet () const
 
ProtocolPacketpacket ()
 
std::vector< Option > const & options () const
 
std::vector< Option > & options ()
 
TransmissionPacketdoNotDiscard ()
 
TransmissionPacketdoNotReorder ()
 
void applyOptions (Client const &client)
 Apply packet options to the packet.
 
void applyOptions ()
 Apply packet options to the packet.
 

Static Public Member Functions

static std::shared_ptr< TransmissionPacketcreate (ProtocolPacket::Header header=FGE_NET_BAD_HEADERID)
 
static std::shared_ptr< TransmissionPacketcreate (Packet &&packet)
 

Detailed Description

A packet with configurable options to transmit via a network thread.

Options will be applied at the moment when the packet will be sent.

Warning
When the packet is pushed via Client::pushPacket or ClientList::sendToAll, the user must not modify the packet/options anymore causing undefined behavior.

Member Enumeration Documentation

◆ Options

Options to pass to the network thread when sending a packet.

Enumerator
UPDATE_TIMESTAMP 

The timestamp of the packet will be updated when sending.

UPDATE_FULL_TIMESTAMP 

The full timestamp of the packet will be updated when sending.

UPDATE_CORRECTION_LATENCY 

The latency of the packet will be updated with the corrector latency from the Client.

Member Function Documentation

◆ applyOptions() [1/2]

void fge::net::TransmissionPacket::applyOptions ( )

Apply packet options to the packet.

Same as applyOptions(Client const& client) but without the client parameter. UPDATE_CORRECTION_LATENCY will throw.

◆ applyOptions() [2/2]

void fge::net::TransmissionPacket::applyOptions ( Client const & client)

Apply packet options to the packet.

See also
Options
Parameters
clientThe client to apply the options

The documentation for this struct was generated from the following files: