Add headless runtime tooling and Campaign.win analysis

This commit is contained in:
Jan Petykiewicz 2026-04-10 01:22:47 -07:00
commit 27172e3786
37 changed files with 11867 additions and 302 deletions

View file

@ -0,0 +1,40 @@
use serde::{Deserialize, Serialize};
use crate::{CalendarPoint, RuntimeState};
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct RuntimeSummary {
pub calendar: CalendarPoint,
pub world_flag_count: usize,
pub company_count: usize,
pub event_runtime_record_count: usize,
pub total_event_record_service_count: u64,
pub periodic_boundary_call_count: u64,
pub total_trigger_dispatch_count: u64,
pub dirty_rerun_count: u64,
pub total_company_cash: i64,
}
impl RuntimeSummary {
pub fn from_state(state: &RuntimeState) -> Self {
Self {
calendar: state.calendar,
world_flag_count: state.world_flags.len(),
company_count: state.companies.len(),
event_runtime_record_count: state.event_runtime_records.len(),
total_event_record_service_count: state.service_state.total_event_record_services,
periodic_boundary_call_count: state.service_state.periodic_boundary_calls,
total_trigger_dispatch_count: state
.service_state
.trigger_dispatch_counts
.values()
.sum(),
dirty_rerun_count: state.service_state.dirty_rerun_count,
total_company_cash: state
.companies
.iter()
.map(|company| company.current_cash)
.sum(),
}
}
}