Fix wall drawing bug and get rid of clippy warnings

This commit is contained in:
Timothy Warren 2021-11-16 10:45:39 -05:00
parent a198fe1832
commit c4bc637c79
4 changed files with 6 additions and 3 deletions

View File

@ -209,6 +209,7 @@ pub fn show_inventory(gs: &mut State, ctx: &mut Rltk) -> (ItemMenuResult, Option
let mut equippable: Vec<Entity> = 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<Entity> = 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<Entity> = 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)

View File

@ -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;
}

View File

@ -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 {

View File

@ -92,7 +92,7 @@ macro_rules! deserialize_individually {
$(
DeserializeComponents::<NoError, _>::deserialize(
&mut ( &mut $ecs.write_storage::<$type>(), ),
&mut $data.0, // entities
&$data.0, // entities
&mut $data.1, // marker
&mut $data.2, // allocater
&mut $de,