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:
1 parent
766b65b2fc
commit
55a260755c
8 files changed
+115
-58
No files matched your search
@@ -15,7 +15,7 @@ impl BaseBuilding {
|
||||
durability: 1500,
|
||||
stress: 0,
|
||||
owner,
|
||||
level: b'1',
|
||||
level: 1,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,7 @@ impl Structure for BaseBuilding {
|
||||
}
|
||||
|
||||
fn get_level(&self) -> char {
|
||||
self.level as char
|
||||
(self.level + b'0') as char
|
||||
}
|
||||
|
||||
fn get_durability(&self) -> u16 {
|
||||
|
||||
Reference in new issue
Block a user