From 11fecd5bda7d0555998b1b1ca5c221a21192fecf Mon Sep 17 00:00:00 2001 From: jake Date: Wed, 25 Nov 2020 22:09:00 -0700 Subject: [PATCH] fix tests that care about rooms --- src/ship/ship.rs | 10 +++++----- tests/test_exp_gain.rs | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/ship/ship.rs b/src/ship/ship.rs index 7810e12..9bd9706 100644 --- a/src/ship/ship.rs +++ b/src/ship/ship.rs @@ -263,7 +263,7 @@ impl ClientState { settings: settings, character: character, session: session, - block: 1, + block: 0, item_drop_location: None, done_loading_quest: false, area: None, @@ -379,9 +379,9 @@ impl ShipServerStateBuilder { } -struct Block { +pub struct Block { client_location: Box, - rooms: Box, + pub rooms: Box, } impl Default for Block { @@ -393,7 +393,7 @@ impl Default for Block { } } -struct Blocks(Vec); +pub struct Blocks(pub Vec); impl Blocks { fn with_client(&mut self, id: ClientId, clients: &Clients) -> Result<&mut Block, ShipError> { @@ -410,7 +410,7 @@ pub struct ShipServerState { item_manager: items::ItemManager, quests: quests::QuestList, shops: Box, - blocks: Blocks, + pub blocks: Blocks, ip: Ipv4Addr, port: u16, diff --git a/tests/test_exp_gain.rs b/tests/test_exp_gain.rs index 343d804..fde9930 100644 --- a/tests/test_exp_gain.rs +++ b/tests/test_exp_gain.rs @@ -25,7 +25,7 @@ async fn test_character_gains_exp() { create_room(&mut ship, ClientId(1), "room", "").await; let (enemy_id, exp) = { - let room = ship.rooms[0].as_ref().unwrap(); + let room = ship.blocks.0[0].rooms[0].as_ref().unwrap(); let (enemy_id, map_enemy) = (0..).filter_map(|i| { room.maps.enemy_by_id(i).map(|enemy| { (i, enemy) @@ -64,7 +64,7 @@ async fn test_character_levels_up() { create_room(&mut ship, ClientId(1), "room", "").await; let enemy_id = { - let room = ship.rooms[0].as_ref().unwrap(); + let room = ship.blocks.0[0].rooms[0].as_ref().unwrap(); (0..).filter_map(|i| { room.maps.enemy_by_id(i).map(|_| { i @@ -102,7 +102,7 @@ async fn test_character_levels_up_multiple_times() { create_room(&mut ship, ClientId(1), "room", "").await; let (enemy_id, exp) = { - let room = ship.rooms[0].as_ref().unwrap(); + let room = ship.blocks.0[0].rooms[0].as_ref().unwrap(); let (enemy_id, map_enemy) = (0..).filter_map(|i| { room.maps.enemy_by_id(i).ok().and_then(|enemy| { if enemy.monster == MonsterType::DarkFalz2 { @@ -152,7 +152,7 @@ async fn test_one_character_gets_full_exp_and_other_attacker_gets_partial() { join_room(&mut ship, ClientId(2), 0).await; let (enemy_id, exp) = { - let room = ship.rooms[0].as_ref().unwrap(); + let room = ship.blocks.0[0].rooms[0].as_ref().unwrap(); let (enemy_id, map_enemy) = (0..).filter_map(|i| { room.maps.enemy_by_id(i).ok().and_then(|enemy| { if enemy.monster == MonsterType::DarkFalz2 {