Add headless runtime tooling and Campaign.win analysis
This commit is contained in:
parent
57bf0666e0
commit
27172e3786
37 changed files with 11867 additions and 302 deletions
40
crates/rrt-runtime/src/summary.rs
Normal file
40
crates/rrt-runtime/src/summary.rs
Normal 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(),
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue