OpenTTD
Public Member Functions | Data Fields | Static Public Attributes
PacketReader Struct Reference

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

Inheritance diagram for PacketReader:
LoadFilter

Public Member Functions

 PacketReader ()
 Initialise everything. More...
 
void AddPacket (const Packet *p)
 Add a packet to this buffer. More...
 
size_t Read (byte *rbuf, size_t size)
 Read a given number of bytes from the savegame. More...
 
void Reset ()
 Reset this filter to read from the beginning of the file.
 
- Public Member Functions inherited from LoadFilter
 LoadFilter (LoadFilter *chain)
 Initialise this filter. More...
 
virtual ~LoadFilter ()
 Make sure the writers are properly closed. More...
 

Data Fields

AutoFreeSmallVector< byte *, 16 > blocks
 Buffer with blocks of allocated memory.
 
byte * buf
 Buffer we're going to write to/read from.
 
byte * bufe
 End of the buffer we write to/read from.
 
byte ** block
 The block we're reading from/writing to.
 
size_t written_bytes
 The total number of bytes we've written.
 
size_t read_bytes
 The total number of read bytes.
 
- Data Fields inherited from LoadFilter
LoadFilterchain
 Chained to the (savegame) filters. More...
 

Static Public Attributes

static const size_t CHUNK = 32 * 1024
 32 KiB chunks of memory.
 

Detailed Description

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

Definition at line 43 of file network_client.cpp.

Constructor & Destructor Documentation

◆ PacketReader()

PacketReader::PacketReader ( )
inline

Initialise everything.

Definition at line 54 of file network_client.cpp.

Member Function Documentation

◆ AddPacket()

void PacketReader::AddPacket ( const Packet p)
inline

Add a packet to this buffer.

Parameters
pThe packet to add.

Definition at line 62 of file network_client.cpp.

Referenced by ClientNetworkGameSocketHandler::Receive_SERVER_MAP_DATA().

◆ Read()

size_t PacketReader::Read ( byte *  buf,
size_t  len 
)
inlinevirtual

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 89 of file network_client.cpp.

References CHUNK, and min().


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