OpenTTD Source 20250502-master-ge0a9c7d818
PacketReader Struct Reference

Read some packets, and when do use that data as initial load filter. More...

Inheritance diagram for PacketReader:
LoadFilter

Public Types

using Buffer = std::deque< uint8_t >
 The underlying buffer type that's being use.
 

Public Member Functions

 PacketReader ()
 Initialise everything.
 
void AddPacket (Packet &p)
 Add a packet to this buffer.
 
size_t Read (uint8_t *rbuf, size_t size) override
 Read a given number of bytes from the savegame.
 
void Reset () override
 Reset this filter to read from the beginning of the file.
 
- Public Member Functions inherited from LoadFilter
 LoadFilter (std::shared_ptr< LoadFilter > chain)
 Initialise this filter.
 
virtual ~LoadFilter ()=default
 Make sure the writers are properly closed.
 

Data Fields

Buffer buffer
 Buffer with the raw save game data.
 
Buffer::const_iterator iterator
 Buffer we're going to write to/read from.
 
size_t read_bytes = 0
 The total number of read bytes.
 
- Data Fields inherited from LoadFilter
std::shared_ptr< LoadFilterchain
 Chained to the (savegame) filters.
 

Detailed Description

Read some packets, and when do use that data as initial load filter.

Definition at line 43 of file network_client.cpp.

Member Typedef Documentation

◆ Buffer

using PacketReader::Buffer = std::deque<uint8_t>

The underlying buffer type that's being use.

Definition at line 44 of file network_client.cpp.

Constructor & Destructor Documentation

◆ PacketReader()

PacketReader::PacketReader ( )
inline

Initialise everything.

Definition at line 51 of file network_client.cpp.

Member Function Documentation

◆ AddPacket()

void PacketReader::AddPacket ( Packet p)
inline

Add a packet to this buffer.

Parameters
pThe packet to add.

Definition at line 59 of file network_client.cpp.

References Packet::TransferOut().

◆ Read()

size_t PacketReader::Read ( uint8_t *  buf,
size_t  len 
)
inlineoverridevirtual

Read a given number of bytes from the savegame.

Parameters
bufThe bytes to read.
lenThe number of bytes to read.
Returns
The number of actually read bytes.

Implements LoadFilter.

Definition at line 68 of file network_client.cpp.

◆ Reset()

void PacketReader::Reset ( )
inlineoverridevirtual

Reset this filter to read from the beginning of the file.

Reimplemented from LoadFilter.

Definition at line 80 of file network_client.cpp.

Field Documentation

◆ buffer

Buffer PacketReader::buffer

Buffer with the raw save game data.

Definition at line 46 of file network_client.cpp.

◆ iterator

Buffer::const_iterator PacketReader::iterator

Buffer we're going to write to/read from.

Definition at line 47 of file network_client.cpp.

◆ read_bytes

size_t PacketReader::read_bytes = 0

The total number of read bytes.

Definition at line 48 of file network_client.cpp.


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