Execute recovered world scalar event descriptors
This commit is contained in:
parent
09039d24e4
commit
13c7268b0d
23 changed files with 675 additions and 98 deletions
|
|
@ -26,6 +26,7 @@ pub struct RuntimeSummary {
|
|||
pub world_restore_ai_ignore_territories_at_startup_enabled: Option<bool>,
|
||||
pub world_restore_limited_track_building_amount: Option<i32>,
|
||||
pub world_restore_economic_status_code: Option<i32>,
|
||||
pub world_restore_territory_access_cost: Option<u32>,
|
||||
pub world_restore_absolute_counter_restore_kind: Option<String>,
|
||||
pub world_restore_absolute_counter_adjustment_context: Option<String>,
|
||||
pub metadata_count: usize,
|
||||
|
|
@ -77,6 +78,7 @@ pub struct RuntimeSummary {
|
|||
pub named_locomotive_availability_count: usize,
|
||||
pub zero_named_locomotive_availability_count: usize,
|
||||
pub named_locomotive_cost_count: usize,
|
||||
pub cargo_production_override_count: usize,
|
||||
pub special_condition_count: usize,
|
||||
pub enabled_special_condition_count: usize,
|
||||
pub save_profile_kind: Option<String>,
|
||||
|
|
@ -149,6 +151,7 @@ impl RuntimeSummary {
|
|||
.world_restore
|
||||
.limited_track_building_amount,
|
||||
world_restore_economic_status_code: state.world_restore.economic_status_code,
|
||||
world_restore_territory_access_cost: state.world_restore.territory_access_cost,
|
||||
world_restore_absolute_counter_restore_kind: state
|
||||
.world_restore
|
||||
.absolute_counter_restore_kind
|
||||
|
|
@ -597,6 +600,7 @@ impl RuntimeSummary {
|
|||
.filter(|value| **value == 0)
|
||||
.count(),
|
||||
named_locomotive_cost_count: state.named_locomotive_cost.len(),
|
||||
cargo_production_override_count: state.cargo_production_overrides.len(),
|
||||
special_condition_count: state.special_conditions.len(),
|
||||
enabled_special_condition_count: state
|
||||
.special_conditions
|
||||
|
|
@ -820,6 +824,7 @@ mod tests {
|
|||
candidate_availability: BTreeMap::new(),
|
||||
named_locomotive_availability: BTreeMap::new(),
|
||||
named_locomotive_cost: BTreeMap::new(),
|
||||
cargo_production_overrides: BTreeMap::new(),
|
||||
special_conditions: BTreeMap::new(),
|
||||
service_state: RuntimeServiceState::default(),
|
||||
};
|
||||
|
|
@ -920,6 +925,7 @@ mod tests {
|
|||
candidate_availability: BTreeMap::new(),
|
||||
named_locomotive_availability: BTreeMap::new(),
|
||||
named_locomotive_cost: BTreeMap::new(),
|
||||
cargo_production_overrides: BTreeMap::new(),
|
||||
special_conditions: BTreeMap::new(),
|
||||
service_state: RuntimeServiceState::default(),
|
||||
};
|
||||
|
|
@ -969,6 +975,7 @@ mod tests {
|
|||
("Mikado".to_string(), 0),
|
||||
]),
|
||||
named_locomotive_cost: BTreeMap::new(),
|
||||
cargo_production_overrides: BTreeMap::new(),
|
||||
special_conditions: BTreeMap::new(),
|
||||
service_state: RuntimeServiceState::default(),
|
||||
};
|
||||
|
|
@ -1010,6 +1017,7 @@ mod tests {
|
|||
("Big Boy".to_string(), 250000),
|
||||
("GP7".to_string(), 175000),
|
||||
]),
|
||||
cargo_production_overrides: BTreeMap::new(),
|
||||
special_conditions: BTreeMap::new(),
|
||||
service_state: RuntimeServiceState::default(),
|
||||
};
|
||||
|
|
@ -1019,6 +1027,47 @@ mod tests {
|
|||
assert_eq!(summary.named_locomotive_cost_count, 2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn counts_world_scalar_override_surfaces() {
|
||||
let state = RuntimeState {
|
||||
calendar: CalendarPoint {
|
||||
year: 1830,
|
||||
month_slot: 0,
|
||||
phase_slot: 0,
|
||||
tick_slot: 0,
|
||||
},
|
||||
world_flags: BTreeMap::new(),
|
||||
save_profile: RuntimeSaveProfileState::default(),
|
||||
world_restore: RuntimeWorldRestoreState {
|
||||
territory_access_cost: Some(750000),
|
||||
..RuntimeWorldRestoreState::default()
|
||||
},
|
||||
metadata: BTreeMap::new(),
|
||||
companies: Vec::new(),
|
||||
selected_company_id: None,
|
||||
players: Vec::new(),
|
||||
selected_player_id: None,
|
||||
trains: Vec::new(),
|
||||
locomotive_catalog: Vec::new(),
|
||||
territories: Vec::new(),
|
||||
company_territory_track_piece_counts: Vec::new(),
|
||||
company_territory_access: Vec::new(),
|
||||
packed_event_collection: None,
|
||||
event_runtime_records: Vec::new(),
|
||||
candidate_availability: BTreeMap::new(),
|
||||
named_locomotive_availability: BTreeMap::new(),
|
||||
named_locomotive_cost: BTreeMap::new(),
|
||||
cargo_production_overrides: BTreeMap::from([(1, 125), (2, 250)]),
|
||||
special_conditions: BTreeMap::new(),
|
||||
service_state: RuntimeServiceState::default(),
|
||||
};
|
||||
|
||||
let summary = RuntimeSummary::from_state(&state);
|
||||
|
||||
assert_eq!(summary.cargo_production_override_count, 2);
|
||||
assert_eq!(summary.world_restore_territory_access_cost, Some(750000));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn counts_world_frontier_buckets_separately() {
|
||||
let state = RuntimeState {
|
||||
|
|
@ -1110,6 +1159,7 @@ mod tests {
|
|||
candidate_availability: BTreeMap::new(),
|
||||
named_locomotive_availability: BTreeMap::new(),
|
||||
named_locomotive_cost: BTreeMap::new(),
|
||||
cargo_production_overrides: BTreeMap::new(),
|
||||
special_conditions: BTreeMap::new(),
|
||||
service_state: RuntimeServiceState::default(),
|
||||
};
|
||||
|
|
@ -1189,6 +1239,7 @@ mod tests {
|
|||
candidate_availability: BTreeMap::new(),
|
||||
named_locomotive_availability: BTreeMap::new(),
|
||||
named_locomotive_cost: BTreeMap::new(),
|
||||
cargo_production_overrides: BTreeMap::new(),
|
||||
special_conditions: BTreeMap::new(),
|
||||
service_state: RuntimeServiceState::default(),
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue