diff options
author | tom barrett <spalf0@gmail.com> | 2019-02-19 13:24:25 -0600 |
---|---|---|
committer | tom barrett <spalf0@gmail.com> | 2019-02-19 13:24:25 -0600 |
commit | a4efade392aa7127c373b0247d39274cb0decd10 (patch) | |
tree | 72ff44e69917873ca9933c4a56794a15b99fb90c /src/item.rs | |
parent | 892088d723fd3dc0aae969273331c2765f322e6f (diff) |
unified all server->client connection and brought logic to modules
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, } } |