summaryrefslogtreecommitdiffstats
path: root/src/state.rs
diff options
context:
space:
mode:
authorRose Hogenson <rosehogenson@posteo.net>2023-07-21 22:42:51 -0700
committerRose Hogenson <rosehogenson@posteo.net>2023-07-21 22:42:51 -0700
commit1ecadfb0adf839c719ba50914c7336488ca55a47 (patch)
tree5d7419007e983c2ba684b89f402615205345fef6 /src/state.rs
parentd075c455b1ed5fe89fb949ca1f019de97ffb832a (diff)
downloadstallman-shooter-1ecadfb0adf839c719ba50914c7336488ca55a47.tar.zst
Fix clippy warnings.
Diffstat (limited to 'src/state.rs')
-rw-r--r--src/state.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/state.rs b/src/state.rs
index 663e762..be89d3d 100644
--- a/src/state.rs
+++ b/src/state.rs
@@ -63,8 +63,8 @@ impl PBullet {
PBullet {
real_x: x as f64,
real_y: y as f64,
- d_x: d_x,
- d_y: d_y,
+ d_x,
+ d_y,
}
}
pub fn damage() -> f64 {
@@ -109,7 +109,7 @@ fn dist(x1: i32, y1: i32, x2: i32, y2: i32) -> f64 {
pub trait Positioned {
fn x(&self) -> i32;
fn y(&self) -> i32;
- fn radius() -> u32;
+ fn radius() -> i32;
fn contains(&self, x: i32, y: i32) -> bool {
let d = dist(self.x(), self.y(), x, y);
d <= Self::radius() as f64
@@ -120,7 +120,7 @@ pub trait Positioned {
let sy = self.y();
let oy = other.y();
let threshold = Self::radius() + T::radius();
- if (sx - ox).abs() as u32 >= threshold || (sy - oy).abs() as u32 >= threshold {
+ if (sx - ox).abs() >= threshold || (sy - oy).abs() >= threshold {
return false;
}
let dist = dist(sx, sy, ox, oy);
@@ -143,7 +143,7 @@ impl Positioned for PBullet {
fn y(&self) -> i32 {
self.real_y.round() as i32
}
- fn radius() -> u32 {
+ fn radius() -> i32 {
10
}
}
@@ -157,7 +157,7 @@ pub trait Drawable: Positioned {
let x0 = self.x() - cx as i32;
let y0 = self.y() - cy as i32;
canvas
- .copy(&texture, None, Some(sdl2::rect::Rect::new(x0, y0, tw, th)))
+ .copy(texture, None, Some(sdl2::rect::Rect::new(x0, y0, tw, th)))
.unwrap();
}
}