OpenTTD

Public Member Functions | Data Fields
MemoryDumper Struct Reference

Container for dumping the savegame (quickly) to memory. More...

## Public Member Functions
| MemoryDumper ()
| Initialise our variables. More...
void | WriteByte (byte b)
| Write a single byte into the dumper. More...
void | Flush (SaveFilter *writer)
| Flush this dumper into a writer. More...
size_t | GetSize () const
| Get the size of the memory dump made so far. More...

## Data Fields
AutoFreeSmallVector< byte *, 16 > | blocks
| Buffer with blocks of allocated memory.
byte * | buf
| Buffer we're going to write to.
byte * | bufe
| End of the buffer we write to.

## Detailed Description

Container for dumping the savegame (quickly) to memory.

Definition at line 340 of file saveload.cpp.

## Constructor & Destructor Documentation

## ◆ MemoryDumper()

MemoryDumper::MemoryDumper | ( |  | ) |
| inline

Initialise our variables.

Definition at line 346 of file saveload.cpp.

## Member Function Documentation

## ◆ Flush()

void MemoryDumper::Flush | ( | SaveFilter * | writer | ) |
| inline

Flush this dumper into a writer.

Parameters

  writer | The filter we want to use.

Definition at line 370 of file saveload.cpp.

References SaveFilter::Finish(), ReadBuffer::GetSize(), MEMORY_CHUNK_SIZE, min(), and SaveFilter::Write().

## ◆ GetSize()

size_t MemoryDumper::GetSize | ( |  | ) | const
| inline

Get the size of the memory dump made so far.

Returns
  The size.

Definition at line 389 of file saveload.cpp.

References ReadBuffer::buf, SmallVector< T, S >::Length(), and MEMORY_CHUNK_SIZE.

## ◆ WriteByte()

void MemoryDumper::WriteByte | ( | byte | b | ) |
| inline

Write a single byte into the dumper.

Parameters

  b | The byte to write.

Definition at line 354 of file saveload.cpp.

References SmallVector< T, S >::Append(), ReadBuffer::buf, and MEMORY_CHUNK_SIZE.

Referenced by SlWriteByte().

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

- src/saveload/saveload.cpp