red-life
red-life copied to clipboard
Replace Item name with ItemType
There's limited amount of items and they can be identified with enum, name can be retrieved when needed
This should also reduce code noise.
I suggest to create solution similar to Machine solution:
#[derive(Debug, Copy, Clone, serde::Serialize, serde::Deserialize)]
pub enum ItemType {
SuperGlue = 0,
Petrol = 1,
// ...
}
impl ItemType {
pub fn t(self, lng: Lang) -> 'static str {
item_names(lng)[self as usize]
}
}