OpenTTD
|
Read some packets, and when do use that data as initial load filter. More...
Public Member Functions | |
PacketReader () | |
Initialise everything. | |
void | AddPacket (const Packet *p) |
Add a packet to this buffer. | |
size_t | Read (byte *rbuf, size_t size) |
Read a given number of bytes from the savegame. | |
void | Reset () |
Reset this filter to read from the beginning of the file. | |
![]() | |
LoadFilter (LoadFilter *chain) | |
Initialise this filter. | |
virtual | ~LoadFilter () |
Make sure the writers are properly closed. |
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. | |
![]() | |
LoadFilter * | chain |
Chained to the (savegame) filters. |
Static Public Attributes | |
static const size_t | CHUNK = 32 * 1024 |
32 KiB chunks of memory. |
Read some packets, and when do use that data as initial load filter.
Definition at line 43 of file network_client.cpp.
|
inline |
Initialise everything.
Definition at line 54 of file network_client.cpp.
|
inline |
Add a packet to this buffer.
p | The packet to add. |
Definition at line 62 of file network_client.cpp.
References SmallVector< T, S >::Append(), blocks, buf, bufe, Packet::buffer, CHUNK, min(), Packet::pos, read_bytes, Packet::size, and written_bytes.
Referenced by ClientNetworkGameSocketHandler::Receive_SERVER_MAP_DATA().
|
inlinevirtual |
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 89 of file network_client.cpp.
References block, buf, bufe, CHUNK, min(), read_bytes, and written_bytes.