OpenTTD Source 20250206-master-g6089ed8059
|
Read some packets, and when do use that data as initial load filter. More...
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. | |
Static Public Member Functions | |
static ssize_t | TransferOutMemCopy (PacketReader *destination, const char *source, size_t amount) |
Simple wrapper around fwrite to be able to pass it to Packet's TransferOut. | |
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< LoadFilter > | chain |
Chained to the (savegame) filters. | |
Read some packets, and when do use that data as initial load filter.
Definition at line 43 of file network_client.cpp.
using PacketReader::Buffer = std::deque<uint8_t> |
The underlying buffer type that's being use.
Definition at line 44 of file network_client.cpp.
|
inline |
Initialise everything.
Definition at line 51 of file network_client.cpp.
|
inline |
Add a packet to this buffer.
p | The packet to add. |
Definition at line 72 of file network_client.cpp.
References Packet::TransferOut(), and TransferOutMemCopy().
|
inlineoverridevirtual |
Read a given number of bytes from the savegame.
buf | The bytes to read. |
len | The number of bytes to read. |
Implements LoadFilter.
Definition at line 78 of file network_client.cpp.
|
inlineoverridevirtual |
Reset this filter to read from the beginning of the file.
Reimplemented from LoadFilter.
Definition at line 90 of file network_client.cpp.
|
inlinestatic |
Simple wrapper around fwrite to be able to pass it to Packet's TransferOut.
destination | The reader to add the data to. |
source | The buffer to read data from. |
amount | The number of bytes to copy. |
Definition at line 62 of file network_client.cpp.
References buffer.
Referenced by AddPacket().
Buffer PacketReader::buffer |
Buffer with the raw save game data.
Definition at line 46 of file network_client.cpp.
Referenced by TransferOutMemCopy().
Buffer::const_iterator PacketReader::iterator |
Buffer we're going to write to/read from.
Definition at line 47 of file network_client.cpp.
size_t PacketReader::read_bytes = 0 |
The total number of read bytes.
Definition at line 48 of file network_client.cpp.