From df7793549c158a4b88a9980584e2e607132cbb3b Mon Sep 17 00:00:00 2001 From: Snowram Date: Tue, 18 Aug 2020 21:46:08 +0200 Subject: [PATCH] Add 1st and 2nd item of inventory in hotbar --- voxygen/src/profile.rs | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/voxygen/src/profile.rs b/voxygen/src/profile.rs index 9ebb3d480d..f3c1251ab0 100644 --- a/voxygen/src/profile.rs +++ b/voxygen/src/profile.rs @@ -16,7 +16,18 @@ pub struct CharacterProfile { impl Default for CharacterProfile { fn default() -> Self { CharacterProfile { - hotbar_slots: [None; 10], + hotbar_slots: [ + None, + None, + None, + None, + None, + Some(hud::HotbarSlotContents::Inventory(0)), + Some(hud::HotbarSlotContents::Inventory(1)), + None, + None, + None, + ], } } } @@ -183,13 +194,35 @@ mod tests { fn test_get_slots_with_empty_profile() { let mut profile = Profile::default(); let slots = profile.get_hotbar_slots("TestServer", 12345); - assert_eq!(slots, [None; 10]) + assert_eq!(slots, [ + None, + None, + None, + None, + None, + Some(hud::HotbarSlotContents::Inventory(0)), + Some(hud::HotbarSlotContents::Inventory(1)), + None, + None, + None, + ]) } #[test] fn test_set_slots_with_empty_profile() { let mut profile = Profile::default(); - let slots = [None; 10]; + let slots = [ + None, + None, + None, + None, + None, + Some(hud::HotbarSlotContents::Inventory(0)), + Some(hud::HotbarSlotContents::Inventory(1)), + None, + None, + None, + ]; profile.set_hotbar_slots("TestServer", 12345, slots); } }