generated from GarandPLG/rust-flake-template
Add ore level support and unify text rendering
Introduce a numeric `level` field for `BaseBuilding` and `Ore`, update their constructors and `get_level` implementations, and increase the default ore amount to the new maximum. Extend the `Structure` and `Unit` traits with `base_text` and `text` methods, add `is_unit` to `Units`, and adjust the `Structures` enum to delegate text rendering. Refactor `SidePanelWidget` to use the unified trait methods, removing duplicated rendering code. Update `BoardState` to create ore structures with an initial level of 1.
This commit is contained in:
@@ -2,7 +2,7 @@ use crate::app::states::skirmish_states::{
|
||||
Players,
|
||||
structures::{BaseBuilding, Ore, Stone, Structure, Tunnel},
|
||||
};
|
||||
use ratatui::style::Color;
|
||||
use ratatui::{style::Color, text::Line};
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum Structures {
|
||||
@@ -56,4 +56,8 @@ impl Structure for Structures {
|
||||
fn get_owner(&self) -> Players {
|
||||
self.structure().get_owner()
|
||||
}
|
||||
|
||||
fn text(&self) -> Vec<Line<'_>> {
|
||||
self.structure().text()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user