pub struct Save {
pub metadata: Vec<u8>,
pub state: Vec<u8>,
}Expand description
A save file: its two payloads, expanded. See the module documentation.
Fields§
§metadata: Vec<u8>Expanded metadata stream (the first payload; see SaveMetadata).
state: Vec<u8>Expanded game-state stream (the second payload).
Implementations§
Source§impl Save
impl Save
Sourcepub fn read_metadata(data: &[u8]) -> Result<SaveMetadata>
pub fn read_metadata(data: &[u8]) -> Result<SaveMetadata>
Only the metadata, as the save list reads it: the game state is not expanded.
Original: Persistence::BeginGetSaveGameInfo, then SaveLoad::LoadMetaData.
Original: Runtime 0x1800c43a0.
Sourcepub fn metadata(&self) -> Result<SaveMetadata>
pub fn metadata(&self) -> Result<SaveMetadata>
The metadata: the town’s name, the preview picture and the mods.
Sourcepub fn write(metadata: &SaveMetadata, state: &[u8]) -> Vec<u8> ⓘ
pub fn write(metadata: &SaveMetadata, state: &[u8]) -> Vec<u8> ⓘ
A version 2 save file: the metadata as payload 0x24 and the game state as payload 1,
each compressed (IO::CompressedStream), behind the checked header.
Sourcepub fn event_log(&self) -> Option<SavedEventLog>
pub fn event_log(&self) -> Option<SavedEventLog>
Find the event-log block (version 1: six notify bytes, a count and entries of colour, text, type, severity, cell, category, icon). Located by scanning for a block whose contents parse as exactly that and fill the block; the game-state order before it is not walked.
Sourcepub fn references(&self) -> Result<Vec<(u32, String)>>
pub fn references(&self) -> Result<Vec<(u32, String)>>
External reference table: (id, path) pairs.
Sourcepub fn loop_header(&self) -> Result<LoopHeader>
pub fn loop_header(&self) -> Result<LoopHeader>
The game loop’s header: the seed, the map size, and the terrain, climate and start condition.
Sourcepub fn map_heights(&self) -> Result<MapHeights>
pub fn map_heights(&self) -> Result<MapHeights>
Locate the map block by its dimension header (2n, n, 32, 33, 2n+1, 33^2).