Rename buildings module to structures

This commit is contained in:
2026-04-19 20:02:21 +02:00
parent 33088dc29d
commit 0a8b3562f6
8 changed files with 4 additions and 4 deletions
@@ -0,0 +1,34 @@
use ratatui::style::Color;
use crate::app::states::Players;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct BaseBuilding {
owner: Players,
level: u8,
}
impl BaseBuilding {
pub fn new(owner: Players) -> Self {
Self { owner, level: b'1' }
}
pub fn get_tag(&self) -> char {
'B'
}
pub fn get_color(&self) -> Color {
match self.owner {
Players::Player => Color::LightBlue,
Players::Enemy => Color::LightRed,
}
}
pub fn get_owner(&self) -> Players {
self.owner
}
pub fn get_level(&self) -> char {
self.level as char
}
}
@@ -0,0 +1,7 @@
mod base;
mod stone;
mod tunnel;
pub use base::BaseBuilding;
pub use stone::Stone;
pub use tunnel::Tunnel;
@@ -0,0 +1,20 @@
use ratatui::style::Color;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct Stone {
durability: u16,
}
impl Stone {
pub fn new() -> Self {
Self { durability: 1000 }
}
pub fn get_tag(&self) -> char {
' '
}
pub fn get_color(&self) -> Color {
Color::White
}
}
@@ -0,0 +1,38 @@
use ratatui::style::Color;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct Tunnel {
durability: u16,
stress: u8,
roof_support: bool,
rail: bool,
lamp: bool,
}
impl Tunnel {
pub fn new() -> Self {
Self {
durability: 500,
stress: 25,
roof_support: false,
rail: false,
lamp: false,
}
}
pub fn get_tag(&self) -> char {
'T'
}
pub fn get_color(&self) -> Color {
Color::Gray
}
pub fn get_durability(&self) -> u16 {
self.durability
}
pub fn get_stress(&self) -> u8 {
self.stress
}
}