diff options
Diffstat (limited to 'src/item.rs')
-rw-r--r-- | src/item.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/item.rs b/src/item.rs index 1e0e7ab..006e2dc 100644 --- a/src/item.rs +++ b/src/item.rs @@ -10,21 +10,21 @@ pub enum ItemType { #[derive(Serialize, Deserialize, Debug, Clone)] pub struct Item { - pub itemtype: ItemType, + pub item_type: ItemType, pub name: String, pub size: usize, } impl Item { - pub fn new(itemtype: ItemType) -> Item { - let size = match itemtype { + pub fn new(item_type: ItemType) -> Item { + let size = match item_type { ItemType::Iron => constants::IRON_SIZE, ItemType::Hydrogen => constants::HYDROGEN_SIZE, ItemType::CrudeMinerals => constants::CRUDE_MINERALS_SIZE, }; Item { - name: serde_json::to_string(&itemtype).unwrap() + &rand_name(), - itemtype, + name: serde_json::to_string(&item_type).unwrap() + &rand_name(), + item_type, size, } } |