Add the AirDef tablet web panel and battle archive (#153)
This commit is contained in:
@@ -99,11 +99,13 @@ pub struct Entry {
|
||||
#[derive(Default)]
|
||||
pub struct History {
|
||||
entries: VecDeque<Entry>,
|
||||
first: u64,
|
||||
last: HashMap<(u32, Channel), (Option<u32>, Outcome)>,
|
||||
truncated: bool,
|
||||
}
|
||||
|
||||
impl History {
|
||||
pub fn first_index(&self) -> u64 { self.first }
|
||||
pub fn entries(&self) -> impl DoubleEndedIterator<Item = &Entry> {
|
||||
self.entries.iter()
|
||||
}
|
||||
@@ -184,6 +186,7 @@ impl History {
|
||||
fn push(&mut self, entry: Entry) {
|
||||
if self.entries.len() == MAX_ENTRIES {
|
||||
self.entries.pop_front();
|
||||
self.first += 1;
|
||||
self.truncated = true;
|
||||
}
|
||||
self.entries.push_back(entry);
|
||||
|
||||
@@ -162,6 +162,7 @@ impl Recording {
|
||||
pub fn blank(len: u32) -> Self {
|
||||
Recording {
|
||||
number: 1,
|
||||
started_at: 0,
|
||||
origin: DVec3::ZERO,
|
||||
len,
|
||||
tracks: Vec::new(),
|
||||
@@ -416,6 +417,10 @@ pub struct SceneJournal {
|
||||
}
|
||||
|
||||
impl SceneJournal {
|
||||
pub fn track_limit_reached(&self) -> bool {
|
||||
self.track_events >= MAX_SCENE_TRACK_EVENTS
|
||||
}
|
||||
|
||||
/// Read-only transitions in chronological order.
|
||||
pub fn events(&self) -> &[SceneEvent] { &self.events }
|
||||
|
||||
@@ -577,6 +582,7 @@ impl Tally {
|
||||
pub struct Recording {
|
||||
/// Which raid of the session (1, 2, …).
|
||||
pub number: u32,
|
||||
pub started_at: u64,
|
||||
pub origin: DVec3,
|
||||
/// Its length in ticks.
|
||||
pub len: u32,
|
||||
@@ -830,6 +836,7 @@ impl Recording {
|
||||
let origin = sim.targets.first().copied().or_else(|| sim.sams.first().map(|s| s.pos)).unwrap_or(DVec3::ZERO);
|
||||
Recording {
|
||||
number,
|
||||
started_at: sim.tick,
|
||||
origin: origin.floor(),
|
||||
len: 0,
|
||||
tracks: Vec::new(),
|
||||
|
||||
Reference in New Issue
Block a user