mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 16:21:33 +11:00
Small fixes
This commit is contained in:
parent
3a795fea8f
commit
a365c14917
|
@ -653,10 +653,9 @@ impl<T: Number> Rect<T> {
|
||||||
|
|
||||||
impl<T: FixedWidthUnsignedInteger> Rect<T> {
|
impl<T: FixedWidthUnsignedInteger> Rect<T> {
|
||||||
pub fn iter(self) -> impl Iterator<Item = (T, T)> {
|
pub fn iter(self) -> impl Iterator<Item = (T, T)> {
|
||||||
let mut x = self.position.x - T::one();
|
let mut x = self.position.x;
|
||||||
let mut y = self.position.y;
|
let mut y = self.position.y;
|
||||||
core::iter::from_fn(move || {
|
core::iter::from_fn(move || {
|
||||||
x = x + T::one();
|
|
||||||
if x >= self.position.x + self.size.x {
|
if x >= self.position.x + self.size.x {
|
||||||
x = self.position.x;
|
x = self.position.x;
|
||||||
y = y + T::one();
|
y = y + T::one();
|
||||||
|
@ -665,7 +664,10 @@ impl<T: FixedWidthUnsignedInteger> Rect<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Some((x, y))
|
let ret_x = x;
|
||||||
|
x = x + T::one();
|
||||||
|
|
||||||
|
Some((ret_x, y))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -516,7 +516,7 @@ impl<'a> InfiniteScrolledMap<'a> {
|
||||||
let direction = difference.x.signum();
|
let direction = difference.x.signum();
|
||||||
|
|
||||||
// either need to update 20 or 21 tiles depending on whether the y coordinate is a perfect multiple
|
// either need to update 20 or 21 tiles depending on whether the y coordinate is a perfect multiple
|
||||||
let y_tiles_to_update: i32 = if new_pos.y % 8 == 0 { 20 } else { 21 };
|
let y_tiles_to_update = 21;
|
||||||
|
|
||||||
let line_to_update = if direction < 0 {
|
let line_to_update = if direction < 0 {
|
||||||
// moving to the left, so need to update the left most position
|
// moving to the left, so need to update the left most position
|
||||||
|
@ -540,7 +540,7 @@ impl<'a> InfiniteScrolledMap<'a> {
|
||||||
let direction = difference.y.signum();
|
let direction = difference.y.signum();
|
||||||
|
|
||||||
// either need to update 30 or 31 tiles depending on whether the x coordinate is a perfect multiple
|
// either need to update 30 or 31 tiles depending on whether the x coordinate is a perfect multiple
|
||||||
let x_tiles_to_update: i32 = if new_pos.x % 8 == 0 { 30 } else { 31 };
|
let x_tiles_to_update: i32 = 31;
|
||||||
|
|
||||||
let line_to_update = if direction < 0 {
|
let line_to_update = if direction < 0 {
|
||||||
// moving up so need to update the top
|
// moving up so need to update the top
|
||||||
|
|
Loading…
Reference in a new issue