Rehost periodic route preference service seam
This commit is contained in:
parent
6fc8da2153
commit
f7fde709f7
9 changed files with 578 additions and 49 deletions
|
|
@ -2304,6 +2304,28 @@ pub struct SmpLoadedWorldLocomotivePolicyState {
|
|||
#[serde(default)]
|
||||
pub linked_site_removal_follow_on_gate_raw_hex: Option<String>,
|
||||
#[serde(default)]
|
||||
pub auto_show_grade_during_track_lay_raw_u8: Option<u8>,
|
||||
#[serde(default)]
|
||||
pub auto_show_grade_during_track_lay_raw_hex: Option<String>,
|
||||
#[serde(default)]
|
||||
pub starting_building_density_level_raw_u8: Option<u8>,
|
||||
#[serde(default)]
|
||||
pub starting_building_density_level_raw_hex: Option<String>,
|
||||
#[serde(default)]
|
||||
pub building_density_growth_raw_u8: Option<u8>,
|
||||
#[serde(default)]
|
||||
pub building_density_growth_raw_hex: Option<String>,
|
||||
#[serde(default)]
|
||||
pub leftover_simulation_time_accumulator_raw_u32: Option<u32>,
|
||||
#[serde(default)]
|
||||
pub leftover_simulation_time_accumulator_raw_hex: Option<String>,
|
||||
#[serde(default)]
|
||||
pub leftover_simulation_time_accumulator_value_f32_text: Option<String>,
|
||||
#[serde(default)]
|
||||
pub selected_year_lane_snapshot_raw_u8: Option<u8>,
|
||||
#[serde(default)]
|
||||
pub selected_year_lane_snapshot_raw_hex: Option<String>,
|
||||
#[serde(default)]
|
||||
pub all_steam_locomotives_available_raw_u8: Option<u8>,
|
||||
#[serde(default)]
|
||||
pub all_steam_locomotives_available_raw_hex: Option<String>,
|
||||
|
|
@ -2932,10 +2954,10 @@ pub fn load_save_slice_from_report(
|
|||
.save_world_finance_neighborhood_probe
|
||||
.as_ref()
|
||||
.map(derive_loaded_world_finance_neighborhood_state_from_probe);
|
||||
let world_locomotive_policy_state = report
|
||||
.locomotive_policy_neighborhood_probe
|
||||
.as_ref()
|
||||
.map(derive_loaded_world_locomotive_policy_state_from_probe);
|
||||
let world_locomotive_policy_state = derive_loaded_world_locomotive_policy_state_from_probes(
|
||||
report.post_text_field_neighborhood_probe.as_ref(),
|
||||
report.locomotive_policy_neighborhood_probe.as_ref(),
|
||||
);
|
||||
let company_roster = report.save_company_roster_probe.clone().or_else(|| {
|
||||
report
|
||||
.save_world_selection_context_probe
|
||||
|
|
@ -3638,23 +3660,37 @@ fn derive_loaded_world_finance_neighborhood_state_from_probe(
|
|||
}
|
||||
}
|
||||
|
||||
fn derive_loaded_world_locomotive_policy_state_from_probe(
|
||||
probe: &SmpLocomotivePolicyNeighborhoodProbe,
|
||||
) -> SmpLoadedWorldLocomotivePolicyState {
|
||||
fn derive_loaded_world_locomotive_policy_state_from_probes(
|
||||
post_text_probe: Option<&SmpPostTextFieldNeighborhoodProbe>,
|
||||
locomotive_policy_probe: Option<&SmpLocomotivePolicyNeighborhoodProbe>,
|
||||
) -> Option<SmpLoadedWorldLocomotivePolicyState> {
|
||||
let field_by_name = |name: &str| {
|
||||
probe
|
||||
locomotive_policy_probe?
|
||||
.grounded_field_observations
|
||||
.iter()
|
||||
.find(|field| field.field_name == name)
|
||||
};
|
||||
let post_text_field_by_name = |name: &str| {
|
||||
post_text_probe?
|
||||
.grounded_field_observations
|
||||
.iter()
|
||||
.find(|field| field.field_name == name)
|
||||
};
|
||||
let selected_year_gap_scalar = field_by_name("selected-year bucket companion scalar");
|
||||
let linked_site_gate = field_by_name("linked-site removal follow-on gate");
|
||||
let auto_show_grade = post_text_field_by_name("Auto-Show Grade During Track Lay");
|
||||
let starting_building_density = post_text_field_by_name("Starting Building Density Level");
|
||||
let building_density_growth = post_text_field_by_name("Building Density Growth");
|
||||
let leftover_simulation_time = post_text_field_by_name("leftover simulation time accumulator");
|
||||
let selected_year_snapshot = post_text_field_by_name("selected-year lane snapshot");
|
||||
let all_steam = field_by_name("All Steam Locos Avail.");
|
||||
let all_diesel = field_by_name("All Diesel Locos Avail.");
|
||||
let all_electric = field_by_name("All Electric Locos Avail.");
|
||||
let cached_available_rating = field_by_name("cached available-locomotive rating");
|
||||
SmpLoadedWorldLocomotivePolicyState {
|
||||
source_kind: probe.source_kind.clone(),
|
||||
Some(SmpLoadedWorldLocomotivePolicyState {
|
||||
source_kind: locomotive_policy_probe
|
||||
.map(|probe| probe.source_kind.clone())
|
||||
.or_else(|| post_text_probe.map(|probe| probe.source_kind.clone()))?,
|
||||
semantic_family: "world-locomotive-policy".to_string(),
|
||||
selected_year_gap_scalar_raw_u32: selected_year_gap_scalar
|
||||
.and_then(|field| field.value_u32),
|
||||
|
|
@ -3666,6 +3702,25 @@ fn derive_loaded_world_locomotive_policy_state_from_probe(
|
|||
.and_then(|field| field.value_u8),
|
||||
linked_site_removal_follow_on_gate_raw_hex: linked_site_gate
|
||||
.and_then(|field| field.value_u8_hex.clone()),
|
||||
auto_show_grade_during_track_lay_raw_u8: auto_show_grade.and_then(|field| field.value_u8),
|
||||
auto_show_grade_during_track_lay_raw_hex: auto_show_grade
|
||||
.and_then(|field| field.value_u8_hex.clone()),
|
||||
starting_building_density_level_raw_u8: starting_building_density
|
||||
.and_then(|field| field.value_u8),
|
||||
starting_building_density_level_raw_hex: starting_building_density
|
||||
.and_then(|field| field.value_u8_hex.clone()),
|
||||
building_density_growth_raw_u8: building_density_growth.and_then(|field| field.value_u8),
|
||||
building_density_growth_raw_hex: building_density_growth
|
||||
.and_then(|field| field.value_u8_hex.clone()),
|
||||
leftover_simulation_time_accumulator_raw_u32: leftover_simulation_time
|
||||
.and_then(|field| field.value_u32),
|
||||
leftover_simulation_time_accumulator_raw_hex: leftover_simulation_time
|
||||
.and_then(|field| field.value_u32_hex.clone()),
|
||||
leftover_simulation_time_accumulator_value_f32_text: leftover_simulation_time
|
||||
.and_then(|field| field.probable_f32_le.clone()),
|
||||
selected_year_lane_snapshot_raw_u8: selected_year_snapshot.and_then(|field| field.value_u8),
|
||||
selected_year_lane_snapshot_raw_hex: selected_year_snapshot
|
||||
.and_then(|field| field.value_u8_hex.clone()),
|
||||
all_steam_locomotives_available_raw_u8: all_steam.and_then(|field| field.value_u8),
|
||||
all_steam_locomotives_available_raw_hex: all_steam
|
||||
.and_then(|field| field.value_u8_hex.clone()),
|
||||
|
|
@ -3681,7 +3736,7 @@ fn derive_loaded_world_locomotive_policy_state_from_probe(
|
|||
.and_then(|field| field.value_u32_hex.clone()),
|
||||
cached_available_locomotive_rating_value_f32_text: cached_available_rating
|
||||
.and_then(|field| field.probable_f32_le.clone()),
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fn derive_selection_only_company_roster_from_save_world_probe(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue