Execute world track build limit descriptor

This commit is contained in:
Jan Petykiewicz 2026-04-16 09:20:49 -07:00
commit 43c76adbf0
11 changed files with 439 additions and 9 deletions

View file

@ -311,6 +311,9 @@ fn apply_runtime_effects(
RuntimeEffect::SetWorldFlag { key, value } => {
state.world_flags.insert(key.clone(), *value);
}
RuntimeEffect::SetLimitedTrackBuildingAmount { value } => {
state.world_restore.limited_track_building_amount = Some(*value);
}
RuntimeEffect::SetEconomicStatusCode { value } => {
state.world_restore.economic_status_code = Some(*value);
}
@ -2375,6 +2378,32 @@ mod tests {
assert_eq!(state.world_restore.economic_status_code, Some(3));
}
#[test]
fn applies_limited_track_building_amount_effect() {
let mut state = RuntimeState {
event_runtime_records: vec![RuntimeEventRecord {
record_id: 91,
trigger_kind: 6,
active: true,
service_count: 0,
marks_collection_dirty: false,
one_shot: false,
has_fired: false,
conditions: Vec::new(),
effects: vec![RuntimeEffect::SetLimitedTrackBuildingAmount { value: 18 }],
}],
..state()
};
execute_step_command(
&mut state,
&StepCommand::ServiceTriggerKind { trigger_kind: 6 },
)
.expect("limited-track-building-amount effect should succeed");
assert_eq!(state.world_restore.limited_track_building_amount, Some(18));
}
#[test]
fn confiscate_company_assets_zeros_company_and_retires_owned_trains() {
let mut state = RuntimeState {