From c4bc637c7985dacdddd35d474bfa375040810615 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Tue, 16 Nov 2021 10:45:39 -0500 Subject: [PATCH] Fix wall drawing bug and get rid of clippy warnings --- src/gui.rs | 3 +++ src/map.rs | 2 +- src/monster_ai_system.rs | 2 +- src/saveload_system.rs | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/gui.rs b/src/gui.rs index ebfc586..e404e26 100644 --- a/src/gui.rs +++ b/src/gui.rs @@ -209,6 +209,7 @@ pub fn show_inventory(gs: &mut State, ctx: &mut Rltk) -> (ItemMenuResult, Option let mut equippable: Vec = Vec::new(); let mut j = 0; + #[allow(clippy::explicit_counter_loop)] for (entity, _pack, name) in (&entities, &backpack, &names) .join() .filter(|item| item.1.owner == *player_entity) @@ -296,6 +297,7 @@ pub fn drop_item_menu(gs: &mut State, ctx: &mut Rltk) -> (ItemMenuResult, Option let mut equippable: Vec = Vec::new(); let mut j = 0; + #[allow(clippy::explicit_counter_loop)] for (entity, _pack, name) in (&entities, &backpack, &names) .join() .filter(|item| item.1.owner == *player_entity) @@ -383,6 +385,7 @@ pub fn remove_item_menu(gs: &mut State, ctx: &mut Rltk) -> (ItemMenuResult, Opti let mut equippable: Vec = Vec::new(); let mut j = 0; + #[allow(clippy::explicit_counter_loop)] for (entity, _pack, name) in (&entities, &backpack, &names) .join() .filter(|item| item.1.owner == *player_entity) diff --git a/src/map.rs b/src/map.rs index 22af6f2..12efa42 100644 --- a/src/map.rs +++ b/src/map.rs @@ -261,7 +261,7 @@ pub fn draw_map(ecs: &World, ctx: &mut Rltk) { } fn wall_glyph(map: &Map, x: i32, y: i32) -> rltk::FontCharType { - if x < 1 || x > map.width - 1 || y < 1 || y > map.height - 1 as i32 { + if x < 1 || x > map.width - 2 || y < 1 || y > map.height - 2 { return 35; } diff --git a/src/monster_ai_system.rs b/src/monster_ai_system.rs index dbd97ec..da745ad 100644 --- a/src/monster_ai_system.rs +++ b/src/monster_ai_system.rs @@ -72,7 +72,7 @@ impl<'a> System<'a> for MonsterAI { let path = rltk::a_star_search( map.xy_idx(pos.x, pos.y) as i32, map.xy_idx(player_pos.x, player_pos.y) as i32, - &mut *map, + &*map, ); if path.success && path.steps.len() > 1 { diff --git a/src/saveload_system.rs b/src/saveload_system.rs index a4ca3d8..99c33b2 100644 --- a/src/saveload_system.rs +++ b/src/saveload_system.rs @@ -92,7 +92,7 @@ macro_rules! deserialize_individually { $( DeserializeComponents::::deserialize( &mut ( &mut $ecs.write_storage::<$type>(), ), - &mut $data.0, // entities + &$data.0, // entities &mut $data.1, // marker &mut $data.2, // allocater &mut $de,