Skip to content

Commit

Permalink
Bump version to 1.6 and fix clippy issues
Browse files Browse the repository at this point in the history
  • Loading branch information
NiklasEi committed Jan 15, 2022
1 parent 45f7bcd commit f0786ac
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 27 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "oicana"
description = "A tower-defense game with some puzzle aspects"
version = "1.5.0"
version = "1.6.0"
authors = ["Niklas Eicker <[email protected]>"]
edition = "2021"
publish = false
Expand Down
11 changes: 4 additions & 7 deletions src/bullets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,8 @@ pub struct Bullet {

fn update_bullets(
mut commands: Commands,
mut bullet_query: Query<(Entity, &Bullet, &mut Transform)>,
mut enemy_query: Query<
(&Transform, &mut Health, &mut Enemy),
(Without<Tameable>, Without<Bullet>),
>,
mut bullet_query: Query<(Entity, &Bullet, &mut Transform), Without<Enemy>>,
mut enemy_query: Query<(&Transform, &mut Health, &mut Enemy), Without<Tameable>>,
time: Res<Time>,
) {
let delta = time.delta().as_secs_f32();
Expand All @@ -42,13 +39,13 @@ fn update_bullets(
if distance.length() < bullet.speed * delta {
health.value -= bullet.damage;
commands.entity(bullet_entity).despawn();
to_remove.push(bullet_id.clone());
to_remove.push(*bullet_id);
} else {
let movement = distance.normalize() * bullet.speed * delta;
transform.translation += movement;
}
} else {
to_remove.push(bullet_id.clone());
to_remove.push(*bullet_id);
}
}
enemy.bullets = enemy
Expand Down
2 changes: 1 addition & 1 deletion src/enemies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ fn create_enemy(
max_health: health,
bullets: vec![],
colored_health: health,
color: color.clone(),
color,
travelled: 0.,
};
commands
Expand Down
16 changes: 8 additions & 8 deletions src/loading.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ pub struct TextureAssets {

impl TextureAssets {
pub fn get_handle_for_tile(&self, tile: &Tile) -> Handle<Image> {
match tile {
&Tile::Empty => self.blank.clone(),
&Tile::TowerPlot => self.tower_plot.clone(),
&Tile::Tower => self.tower.clone(),
&Tile::Path => self.path.clone(),
&Tile::Castle => self.castle.clone(),
&Tile::Cloud => self.cloud.clone(),
&Tile::Spawn => self.spawn.clone(),
match *tile {
Tile::Empty => self.blank.clone(),
Tile::TowerPlot => self.tower_plot.clone(),
Tile::Tower => self.tower.clone(),
Tile::Path => self.path.clone(),
Tile::Castle => self.castle.clone(),
Tile::Cloud => self.cloud.clone(),
Tile::Spawn => self.spawn.clone(),
}
}
}
6 changes: 3 additions & 3 deletions src/menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fn setup_menu(
align_items: AlignItems::Center,
..Default::default()
},
color: button_colors.normal.clone(),
color: button_colors.normal,
..Default::default()
})
.insert(PlayButton)
Expand Down Expand Up @@ -68,10 +68,10 @@ fn click_play_button(
state.set(AppState::InGame).unwrap();
}
Interaction::Hovered => {
*color = button_colors.hovered.clone();
*color = button_colors.hovered;
}
Interaction::None => {
*color = button_colors.normal.clone();
*color = button_colors.normal;
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/towers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ fn shoot(
.fold(None, |acc, (entity, _, enemy)| {
if let Some((_, old_travelled)) = acc {
if enemy.travelled > old_travelled {
Some((entity.clone(), enemy.travelled))
Some((entity, enemy.travelled))
} else {
acc
}
} else {
Some((entity.clone(), enemy.travelled))
Some((entity, enemy.travelled))
}
});

Expand Down Expand Up @@ -124,7 +124,7 @@ fn build_and_upgrade_towers(
if transform.translation.x == coordinate.x
&& transform.translation.y == coordinate.y
{
*image = texture_assets.tower.clone().into()
*image = texture_assets.tower.clone()
}
}
commands.spawn_bundle(TowerBundle::new(coordinate));
Expand Down
6 changes: 3 additions & 3 deletions src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ fn retry_system(
align_items: AlignItems::Center,
..Default::default()
},
color: button_materials.normal.clone(),
color: button_materials.normal,
..Default::default()
})
.insert(RetryButton)
Expand Down Expand Up @@ -203,10 +203,10 @@ fn click_retry_button(
state.set(AppState::Restart).unwrap();
}
Interaction::Hovered => {
*color = button_colors.hovered.clone();
*color = button_colors.hovered;
}
Interaction::None => {
*color = button_colors.normal.clone();
*color = button_colors.normal;
}
}
}
Expand Down

0 comments on commit f0786ac

Please sign in to comment.