Refactor skirmish tasks and update dependencies

- Disable automatic board.advance_turn and replace it with explicit unit
  movement handling.
- Add Tunnel structure creation during digging tasks.
- Extend DiggingTask with pop_front and current_target helpers.
- Rename task getters to get_ref_tasks and add mutable get_mut_tasks.
- Update Unit trait and Units enum to expose these new methods.
- Remove unused EMPTY_TASKS lazy static.
- Bump flake.lock revisions, hashes, and timestamps for several
  dependencies.
This commit is contained in:
GarandPLG committed 2026-06-02 15:07:55 +02:00
1 parent 00eeb97ed8
commit 57df985112
7 files changed
+152 -41

No files matched your search

@@ -3,12 +3,9 @@ use crate::app::states::skirmish_states::{
tasks::Tasks,
units::{MinerUnit, Unit},
};
use once_cell::sync::Lazy;
use ratatui::text::Line;
use std::collections::VecDeque;
static EMPTY_TASKS: Lazy<VecDeque<Tasks>> = Lazy::new(|| VecDeque::new());
#[derive(Debug, Clone, PartialEq)]
pub enum Units {
Miner(MinerUnit),
@@ -16,14 +13,14 @@ pub enum Units {
impl Units {
#[inline]
fn u(&self) -> &dyn Unit {
pub fn u(&self) -> &dyn Unit {
match self {
Self::Miner(m) => m,
}
}
#[inline]
fn u_mut(&mut self) -> &mut dyn Unit {
pub fn u_mut(&mut self) -> &mut dyn Unit {
match self {
Self::Miner(m) => m,
}
@@ -63,8 +60,12 @@ impl Unit for Units {
self.u().get_coords()
}
fn get_tasks(&self) -> &VecDeque<Tasks> {
self.u().get_tasks()
fn get_ref_tasks(&self) -> &VecDeque<Tasks> {
self.u().get_ref_tasks()
}
fn get_mut_tasks(&mut self) -> &mut VecDeque<Tasks> {
self.u_mut().get_mut_tasks()
}
fn get_tasks_formatted(&self) -> Vec<Line<'_>> {
@@ -113,8 +114,16 @@ impl Unit for Option<Units> {
self.as_ref().map_or((0, 0), |u| u.get_coords())
}
fn get_tasks(&self) -> &VecDeque<Tasks> {
self.as_ref().map_or(&EMPTY_TASKS, |u| u.get_tasks())
fn get_ref_tasks(&self) -> &VecDeque<Tasks> {
self.as_ref()
.expect("attempted to get referenced tasks from `None`")
.get_ref_tasks()
}
fn get_mut_tasks(&mut self) -> &mut VecDeque<Tasks> {
self.as_mut()
.expect("attempted to get mutable tasks from `None`")
.get_mut_tasks()
}
fn get_tasks_formatted(&self) -> Vec<Line<'_>> {