Skip to content

Replace Item name with ItemType #274

Open
@Eraden

Description

@Eraden

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]
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions