From a4efade392aa7127c373b0247d39274cb0decd10 Mon Sep 17 00:00:00 2001 From: tom barrett Date: Tue, 19 Feb 2019 13:24:25 -0600 Subject: unified all server->client connection and brought logic to modules --- src/item.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/item.rs') 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, } } -- cgit v1.2.3