1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
use fparkan_runtime::{
loaded_mission_script_bundles, Engine, MissionScriptInitExecution, SimulationReport,
};
pub(super) fn log_script_init(engine: &Engine, mission: &str) {
for bundle in loaded_mission_script_bundles(engine).unwrap_or_default() {
let clan = bundle.clan_index;
let script = &bundle.script_path;
for &(instruction, handler) in &bundle.init_stubs {
eprintln!("sim_coverage script_init_handler_stub=1 mission={mission} clan={clan} script={script} instruction={instruction} handler={handler}");
}
if let MissionScriptInitExecution::Unsupported {
event_index,
instruction_index,
error,
} = &bundle.init_execution
{
eprintln!("sim_coverage script_init_unsupported=1 mission={mission} clan={clan} script={script} event={event_index} instruction={instruction_index} reason={error}");
}
}
}
pub(super) fn log_clan_ai_stops(report: &SimulationReport) {
for &(unit, order, count) in &report.script_unit_order_counts {
eprintln!("sim_coverage script_unit_queue_approx={count} unit={unit} order={order}");
}
for &(clan, count) in &report.script_capture_queries {
eprintln!("sim_coverage script_capture_target_approx={count} clan={clan}");
}
for &(clan, count) in &report.script_attack_queries {
eprintln!("sim_coverage script_attack_target_approx={count} clan={clan}");
}
for &(clan, target, count) in &report.script_factory_defence_queries {
eprintln!("sim_coverage script_factory_defence_approx={count} clan={clan} target={target}");
}
for &(clan, target, count) in &report.script_building_defence_queries {
eprintln!(
"sim_coverage script_building_defence_approx={count} clan={clan} target={target}"
);
}
for &(clan, event, instruction, count) in &report.script_area_strength_queries {
eprintln!("sim_coverage script_area_strength_approx={count} clan={clan} event={event} instruction={instruction}");
}
for &(clan, target, count) in &report.script_base_threat_queries {
eprintln!("sim_coverage script_base_threat_approx={count} clan={clan} target={target}");
}
for &(clan, target, count) in &report.script_group_orders {
eprintln!("sim_coverage script_group_order_approx={count} clan={clan} target={target}");
}
for &(clan, x, y, count) in &report.script_point_group_orders {
eprintln!("sim_coverage script_point_group_order_approx={count} clan={clan} x={x} y={y}");
}
for &(clan, x, y, count) in &report.script_point_patrol_continues {
eprintln!(
"sim_coverage script_point_patrol_continue_approx={count} clan={clan} x={x} y={y}"
);
}
for &(clan, class, unit, count) in &report.script_free_unit_queries {
eprintln!(
"sim_coverage script_free_unit_approx={count} clan={clan} class={class} unit={unit}"
);
}
for &(clan, mode, count) in &report.script_group_recruitments {
eprintln!("sim_coverage script_group_recruitment_approx={count} clan={clan} mode={mode}");
}
for &(clan, class, target, count) in &report.script_class_target_queries {
eprintln!("sim_coverage script_class_target_approx={count} clan={clan} class={class} target={target}");
}
for &(clan, unit, count) in &report.script_size_class_queries {
eprintln!("sim_coverage script_size_class_approx={count} clan={clan} unit={unit}");
}
for &(clan, problem, count) in &report.script_problem_waits {
eprintln!("sim_coverage script_problem_wait_approx={count} clan={clan} problem={problem}");
}
for &(clan, target, count) in &report.script_factory_patrol_continues {
eprintln!("sim_coverage script_factory_patrol_continue_approx={count} clan={clan} target={target}");
}
for &(clan, unit, count) in &report.script_ore_transport_orders {
eprintln!("sim_coverage script_ore_transport_approx={count} clan={clan} unit={unit}");
}
for &(clan, class, count) in &report.script_building_site_queries {
eprintln!(
"sim_coverage script_building_site_approx={count} clan={clan} class={class:#010x}"
);
}
for &(clan, builder, class, accepted, rejected) in &report.script_construction_orders {
if accepted != 0 {
eprintln!("sim_coverage script_building_order_approx={accepted} clan={clan} builder={builder} class={class:#010x}");
}
if rejected != 0 {
eprintln!("sim_coverage script_building_rejected={rejected} clan={clan} builder={builder} class={class:#010x}");
}
}
for &(clan, count) in &report.script_capturer_queries {
eprintln!("sim_coverage script_nearest_capturer_approx={count} clan={clan}");
}
for &(unit, target, count) in &report.script_capture_approaches {
eprintln!("sim_coverage script_capture_approach_stub={count} unit={unit} target={target}");
}
for &(clan, target, count) in &report.script_strength_queries {
eprintln!("sim_coverage script_combat_strength_approx={count} clan={clan} target={target}");
}
for &(clan, plant, count) in &report.script_factory_orders {
eprintln!("sim_coverage script_factory_orders_approx={count} clan={clan} plant={plant}");
}
for &(clan, plant, count) in &report.script_factory_rejections {
eprintln!("sim_coverage script_factory_rejections={count} clan={clan} plant={plant}");
}
for (clan, first_ms) in &report.first_factory_completion_ms {
eprintln!("script_factory_completion clan={clan} first_ms={first_ms}");
}
for &(clan, kind, count) in &report.clan_problem_starts {
eprintln!("sim_coverage script_problem_starts_approx={count} clan={clan} problem={kind}");
}
for (&(clan, kind), count) in &report.clan_problem_dispatch_stubs {
eprintln!("sim_coverage script_problem_dispatch_stubs={count} clan={clan} problem={kind}");
}
for &(clan, handler, count) in &report.clan_research_status_stubs {
eprintln!(
"sim_coverage script_research_status_stubs={count} clan={clan} handler={handler}"
);
}
for (stop, count) in &report.clan_ai_event_stops {
eprintln!(
"sim_coverage script_clan_ai_stops={count} clan={} script={} event={} instruction={} reason={}",
stop.clan_index, stop.script_path, stop.event_index, stop.instruction_index, stop.reason,
);
}
}
|