Add side panel and refactor title helpers

Introduce a `side_panel` flag throughout the skirmish state, board
creation,
and cell area calculation to enable a detachable side panel. Refactor
the
title helper to own its strings and use a static separator, updating the
single‑title helper accordingly. Add a new `SidePanelWidget` and expose
the
`skirmish_main_area_layout` helper. Extend keybindings with `Tab` and
`ShiftTab` actions under a new `Opener` group. Update structures and
units
to implement a `get_name` method and adjust related traits and imports.
This commit is contained in:
2026-04-24 11:41:09 +02:00
parent 06a439ff88
commit cf843057c3
23 changed files with 302 additions and 123 deletions
@@ -8,28 +8,52 @@ pub enum Structures {
Stone(Stone),
}
impl Structures {
pub fn get_color(&self) -> Color {
impl Structure for Structures {
fn get_color(&self) -> Color {
match self {
Structures::Base(b) => b.get_color(),
Structures::Tunnel(t) => t.get_color(),
Structures::Stone(s) => s.get_color(),
Self::Base(b) => b.get_color(),
Self::Tunnel(t) => t.get_color(),
Self::Stone(s) => s.get_color(),
}
}
pub fn get_tag(&self) -> char {
fn get_tag(&self) -> char {
match self {
Structures::Base(b) => b.get_tag(),
Structures::Tunnel(t) => t.get_tag(),
Structures::Stone(s) => s.get_tag(),
Self::Base(b) => b.get_tag(),
Self::Tunnel(t) => t.get_tag(),
Self::Stone(s) => s.get_tag(),
}
}
pub fn get_level(&self) -> char {
fn get_level(&self) -> char {
match self {
Structures::Base(b) => b.get_level(),
Structures::Tunnel(t) => t.get_level(),
Structures::Stone(s) => s.get_level(),
Self::Base(b) => b.get_level(),
Self::Tunnel(t) => t.get_level(),
Self::Stone(s) => s.get_level(),
}
}
fn get_name(&self) -> &'static str {
match self {
Self::Base(b) => b.get_name(),
Self::Tunnel(t) => t.get_name(),
Self::Stone(s) => s.get_name(),
}
}
fn get_durability(&self) -> u16 {
match self {
Self::Base(b) => b.get_durability(),
Self::Tunnel(t) => t.get_durability(),
Self::Stone(s) => s.get_durability(),
}
}
fn get_stress(&self) -> u8 {
match self {
Self::Base(b) => b.get_stress(),
Self::Tunnel(t) => t.get_stress(),
Self::Stone(s) => s.get_stress(),
}
}
}