Refactor GameMode and Players into skirmish_states

Move the GameMode and Players enums from the top‑level states module
into the
skirmish_states submodule, add an Unclaimed variant to Players, and
update all
imports, trait implementations, and related logic accordingly. Adjust
the
durability percentage calculation to use u32 for safety.
This commit is contained in:
2026-05-01 19:05:03 +02:00
parent f7c1795f29
commit b639531841
17 changed files with 88 additions and 59 deletions
@@ -1,4 +1,4 @@
use crate::app::states::{Players, skirmish_states::units::Unit};
use crate::app::states::skirmish_states::{Players, units::Unit};
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct MinerUnit {
@@ -1,6 +1,6 @@
use crate::app::states::{
use crate::app::states::skirmish_states::{
Players,
skirmish_states::units::{MinerUnit, Unit},
units::{MinerUnit, Unit},
};
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
@@ -40,6 +40,6 @@ impl Unit for Option<Units> {
}
fn get_owner(&self) -> Players {
self.map_or(Players::Enemy, |u| u.get_owner())
self.map_or(Players::Unclaimed, |u| u.get_owner())
}
}
@@ -1,4 +1,4 @@
use crate::app::states::Players;
use crate::app::states::skirmish_states::Players;
pub trait Unit {
fn get_owner(&self) -> Players;