Implement real company-scoped event descriptors
This commit is contained in:
parent
eb6c4833af
commit
780e739daa
21 changed files with 1483 additions and 56 deletions
|
|
@ -163,7 +163,7 @@ const REAL_GROUPED_EFFECT_DESCRIPTOR_METADATA: [RealGroupedEffectDescriptorMetad
|
|||
label: "Deactivate Company",
|
||||
target_mask_bits: 0x01,
|
||||
parameter_family: "company_lifecycle_toggle",
|
||||
executable_in_runtime: false,
|
||||
executable_in_runtime: true,
|
||||
},
|
||||
RealGroupedEffectDescriptorMetadata {
|
||||
descriptor_id: 15,
|
||||
|
|
@ -177,7 +177,7 @@ const REAL_GROUPED_EFFECT_DESCRIPTOR_METADATA: [RealGroupedEffectDescriptorMetad
|
|||
label: "Company Track Pieces Buildable",
|
||||
target_mask_bits: 0x01,
|
||||
parameter_family: "company_build_limit_scalar",
|
||||
executable_in_runtime: false,
|
||||
executable_in_runtime: true,
|
||||
},
|
||||
];
|
||||
|
||||
|
|
@ -1944,7 +1944,8 @@ fn parse_real_event_runtime_record_summary(
|
|||
.as_ref()
|
||||
.map(|control| decode_real_grouped_effect_actions(&grouped_effect_rows, control))
|
||||
.unwrap_or_default();
|
||||
let executable_import_ready = !decoded_actions.is_empty()
|
||||
let executable_import_ready = !grouped_effect_rows.is_empty()
|
||||
&& decoded_actions.len() == grouped_effect_rows.len()
|
||||
&& decoded_actions
|
||||
.iter()
|
||||
.all(runtime_effect_supported_for_save_import);
|
||||
|
|
@ -2265,6 +2266,25 @@ fn decode_real_grouped_effect_action(
|
|||
});
|
||||
}
|
||||
|
||||
if descriptor_metadata.executable_in_runtime
|
||||
&& descriptor_metadata.descriptor_id == 13
|
||||
&& row.row_shape == "bool_toggle"
|
||||
&& row.raw_scalar_value != 0
|
||||
{
|
||||
return Some(RuntimeEffect::DeactivateCompany { target });
|
||||
}
|
||||
|
||||
if descriptor_metadata.executable_in_runtime
|
||||
&& descriptor_metadata.descriptor_id == 16
|
||||
&& row.row_shape == "scalar_assignment"
|
||||
&& row.raw_scalar_value >= 0
|
||||
{
|
||||
return Some(RuntimeEffect::SetCompanyTrackLayingCapacity {
|
||||
target,
|
||||
value: Some(row.raw_scalar_value as u32),
|
||||
});
|
||||
}
|
||||
|
||||
None
|
||||
}
|
||||
|
||||
|
|
@ -2417,14 +2437,22 @@ fn runtime_effect_supported_for_save_import(effect: &RuntimeEffect) -> bool {
|
|||
RuntimeEffect::SetWorldFlag { .. }
|
||||
| RuntimeEffect::SetCandidateAvailability { .. }
|
||||
| RuntimeEffect::SetSpecialCondition { .. }
|
||||
| RuntimeEffect::DeactivateCompany { .. }
|
||||
| RuntimeEffect::SetCompanyTrackLayingCapacity { .. }
|
||||
| RuntimeEffect::ActivateEventRecord { .. }
|
||||
| RuntimeEffect::DeactivateEventRecord { .. }
|
||||
| RuntimeEffect::RemoveEventRecord { .. } => true,
|
||||
RuntimeEffect::SetCompanyCash { target, .. }
|
||||
| RuntimeEffect::AdjustCompanyCash { target, .. }
|
||||
| RuntimeEffect::AdjustCompanyDebt { target, .. } => {
|
||||
matches!(target, RuntimeCompanyTarget::AllActive)
|
||||
}
|
||||
| RuntimeEffect::AdjustCompanyDebt { target, .. } => matches!(
|
||||
target,
|
||||
RuntimeCompanyTarget::AllActive
|
||||
| RuntimeCompanyTarget::Ids { .. }
|
||||
| RuntimeCompanyTarget::HumanCompanies
|
||||
| RuntimeCompanyTarget::AiCompanies
|
||||
| RuntimeCompanyTarget::SelectedCompany
|
||||
| RuntimeCompanyTarget::ConditionTrueCompany
|
||||
),
|
||||
RuntimeEffect::AppendEventRecord { record } => record
|
||||
.effects
|
||||
.iter()
|
||||
|
|
@ -7513,10 +7541,10 @@ mod tests {
|
|||
.expect("event runtime collection summary should parse");
|
||||
|
||||
assert_eq!(summary.decoded_record_count, 1);
|
||||
assert_eq!(summary.imported_runtime_record_count, 0);
|
||||
assert_eq!(summary.records[0].decode_status, "parity_only");
|
||||
assert_eq!(summary.imported_runtime_record_count, 1);
|
||||
assert_eq!(summary.records[0].decode_status, "executable");
|
||||
assert_eq!(summary.records[0].payload_family, "synthetic_harness");
|
||||
assert!(!summary.records[0].executable_import_ready);
|
||||
assert!(summary.records[0].executable_import_ready);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue