Bridge packed event collection through save import
This commit is contained in:
parent
6ebe5fffeb
commit
83f55fa26e
13 changed files with 653 additions and 35 deletions
|
|
@ -4,8 +4,8 @@ use std::path::Path;
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
CalendarPoint, RuntimeSaveProfileState, RuntimeServiceState, RuntimeState,
|
||||
RuntimeWorldRestoreState, SmpLoadedSaveSlice,
|
||||
CalendarPoint, RuntimePackedEventCollectionSummary, RuntimeSaveProfileState,
|
||||
RuntimeServiceState, RuntimeState, RuntimeWorldRestoreState, SmpLoadedSaveSlice,
|
||||
};
|
||||
|
||||
pub const STATE_DUMP_FORMAT_VERSION: u32 = 1;
|
||||
|
|
@ -56,6 +56,10 @@ pub fn project_save_slice_to_runtime_state_import(
|
|||
"save_slice.special_conditions_present".to_string(),
|
||||
save_slice.special_conditions_table.is_some(),
|
||||
);
|
||||
world_flags.insert(
|
||||
"save_slice.event_runtime_collection_present".to_string(),
|
||||
save_slice.event_runtime_collection.is_some(),
|
||||
);
|
||||
world_flags.insert(
|
||||
"save_slice.mechanism_confidence_grounded".to_string(),
|
||||
save_slice.mechanism_confidence == "grounded",
|
||||
|
|
@ -133,6 +137,33 @@ pub fn project_save_slice_to_runtime_state_import(
|
|||
if let Some(family) = &save_slice.bridge_family {
|
||||
metadata.insert("save_slice.bridge_family".to_string(), family.clone());
|
||||
}
|
||||
let packed_event_collection = save_slice.event_runtime_collection.as_ref().map(|summary| {
|
||||
RuntimePackedEventCollectionSummary {
|
||||
source_kind: summary.source_kind.clone(),
|
||||
mechanism_family: summary.mechanism_family.clone(),
|
||||
mechanism_confidence: summary.mechanism_confidence.clone(),
|
||||
container_profile_family: summary.container_profile_family.clone(),
|
||||
packed_state_version: summary.packed_state_version,
|
||||
packed_state_version_hex: summary.packed_state_version_hex.clone(),
|
||||
live_id_bound: summary.live_id_bound,
|
||||
live_record_count: summary.live_record_count,
|
||||
live_entry_ids: summary.live_entry_ids.clone(),
|
||||
}
|
||||
});
|
||||
if let Some(summary) = &save_slice.event_runtime_collection {
|
||||
metadata.insert(
|
||||
"save_slice.event_runtime_collection_source_kind".to_string(),
|
||||
summary.source_kind.clone(),
|
||||
);
|
||||
metadata.insert(
|
||||
"save_slice.event_runtime_collection_version_hex".to_string(),
|
||||
summary.packed_state_version_hex.clone(),
|
||||
);
|
||||
metadata.insert(
|
||||
"save_slice.event_runtime_collection_record_count".to_string(),
|
||||
summary.live_record_count.to_string(),
|
||||
);
|
||||
}
|
||||
let save_profile = if let Some(profile) = &save_slice.profile {
|
||||
metadata.insert(
|
||||
"save_slice.profile_kind".to_string(),
|
||||
|
|
@ -296,6 +327,7 @@ pub fn project_save_slice_to_runtime_state_import(
|
|||
world_restore,
|
||||
metadata,
|
||||
companies: Vec::new(),
|
||||
packed_event_collection,
|
||||
event_runtime_records: Vec::new(),
|
||||
candidate_availability,
|
||||
special_conditions,
|
||||
|
|
@ -379,6 +411,7 @@ mod tests {
|
|||
world_restore: RuntimeWorldRestoreState::default(),
|
||||
metadata: BTreeMap::new(),
|
||||
companies: Vec::new(),
|
||||
packed_event_collection: None,
|
||||
event_runtime_records: Vec::new(),
|
||||
candidate_availability: BTreeMap::new(),
|
||||
special_conditions: BTreeMap::new(),
|
||||
|
|
@ -502,6 +535,20 @@ mod tests {
|
|||
},
|
||||
],
|
||||
}),
|
||||
event_runtime_collection: Some(crate::SmpLoadedEventRuntimeCollectionSummary {
|
||||
source_kind: "packed-event-runtime-collection".to_string(),
|
||||
mechanism_family: "rt3-105-save-post-span-bridge-v1".to_string(),
|
||||
mechanism_confidence: "mixed".to_string(),
|
||||
container_profile_family: Some("rt3-105-save-container-v1".to_string()),
|
||||
metadata_tag_offset: 0x7100,
|
||||
records_tag_offset: 0x7200,
|
||||
close_tag_offset: 0x7600,
|
||||
packed_state_version: 0x3e9,
|
||||
packed_state_version_hex: "0x000003e9".to_string(),
|
||||
live_id_bound: 5,
|
||||
live_record_count: 3,
|
||||
live_entry_ids: vec![1, 3, 5],
|
||||
}),
|
||||
notes: vec!["packed profile recovered".to_string()],
|
||||
};
|
||||
|
||||
|
|
@ -644,5 +691,22 @@ mod tests {
|
|||
.get("save_slice.profile_byte_0x82_nonzero"),
|
||||
Some(&true)
|
||||
);
|
||||
assert_eq!(
|
||||
import
|
||||
.state
|
||||
.packed_event_collection
|
||||
.as_ref()
|
||||
.map(|summary| summary.live_record_count),
|
||||
Some(3)
|
||||
);
|
||||
assert_eq!(
|
||||
import
|
||||
.state
|
||||
.packed_event_collection
|
||||
.as_ref()
|
||||
.map(|summary| summary.live_entry_ids.clone()),
|
||||
Some(vec![1, 3, 5])
|
||||
);
|
||||
assert!(import.state.event_runtime_records.is_empty());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue