mirror of
https://github.com/italicsjenga/agb.git
synced 2025-01-27 17:46:36 +11:00
satisfy linter
This commit is contained in:
parent
724147ecfa
commit
0ccde7d328
1 changed files with 11 additions and 21 deletions
|
@ -111,9 +111,7 @@ impl<'a> Map<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn get_position(&self, x: i32, y: i32) -> u16 {
|
fn get_position(&self, x: i32, y: i32) -> u16 {
|
||||||
if x < 0 || x as u32 >= self.dimensions.x {
|
if x < 0 || x as u32 >= self.dimensions.x || y < 0 || y as u32 >= self.dimensions.y {
|
||||||
self.default
|
|
||||||
} else if y < 0 || y as u32 >= self.dimensions.y {
|
|
||||||
self.default
|
self.default
|
||||||
} else {
|
} else {
|
||||||
self.store[y as usize * self.dimensions.x as usize + x as usize]
|
self.store[y as usize * self.dimensions.x as usize + x as usize]
|
||||||
|
@ -220,30 +218,22 @@ impl<'a> Background<'a> {
|
||||||
let tile_position_difference = position_difference / 8;
|
let tile_position_difference = position_difference / 8;
|
||||||
|
|
||||||
// how much of the map needs updating
|
// how much of the map needs updating
|
||||||
let difference_x: Rect<i32> = if tile_position_difference.x == 0 {
|
let difference_x: Rect<i32> = match tile_position_difference.x {
|
||||||
Rect::new((0, 0).into(), (0, 0).into())
|
0 => Rect::new((0, 0).into(), (0, 0).into()),
|
||||||
} else if tile_position_difference.x > 0 {
|
1..=i32::MAX => Rect::new((0, 0).into(), (tile_position_difference.x, 0).into()),
|
||||||
Rect::new((0, 0).into(), (tile_position_difference.x, 0).into())
|
i32::MIN..=-1 => Rect::new(
|
||||||
} else if tile_position_difference.x < 0 {
|
|
||||||
Rect::new(
|
|
||||||
(32 + tile_position_difference.x, 0).into(),
|
(32 + tile_position_difference.x, 0).into(),
|
||||||
(tile_position_difference.x.abs(), 0).into(),
|
(tile_position_difference.x.abs(), 0).into(),
|
||||||
)
|
),
|
||||||
} else {
|
|
||||||
unreachable!();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let difference_y: Rect<i32> = if tile_position_difference.y == 0 {
|
let difference_y: Rect<i32> = match tile_position_difference.y {
|
||||||
Rect::new((0, 0).into(), (0, 0).into())
|
0 => Rect::new((0, 0).into(), (0, 0).into()),
|
||||||
} else if tile_position_difference.y > 0 {
|
1..=i32::MAX => Rect::new((0, 0).into(), (0, tile_position_difference.y).into()),
|
||||||
Rect::new((0, 0).into(), (0, tile_position_difference.y).into())
|
i32::MIN..=-1 => Rect::new(
|
||||||
} else if tile_position_difference.y < 0 {
|
|
||||||
Rect::new(
|
|
||||||
(0, 32 + tile_position_difference.y).into(),
|
(0, 32 + tile_position_difference.y).into(),
|
||||||
(0, tile_position_difference.y.abs()).into(),
|
(0, tile_position_difference.y.abs()).into(),
|
||||||
)
|
),
|
||||||
} else {
|
|
||||||
unreachable!();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// update those positions
|
// update those positions
|
||||||
|
|
Loading…
Add table
Reference in a new issue