Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
rparrett committed Dec 7, 2023
1 parent 8f10d6f commit 22d8d1f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
10 changes: 2 additions & 8 deletions src/pathfinding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ impl PathState {

pub fn enemy_cost_fn(map: &Tilemap) -> impl '_ + Fn(TilePos) -> isize {
move |pos| {
let Some(row) = map.tiles.get(pos.x) else {
return -1;
};
let Some(tile) = row.get(pos.y) else {
let Some(tile) = map.get(pos) else {
return -1;
};

Expand All @@ -50,10 +47,7 @@ pub fn enemy_cost_fn(map: &Tilemap) -> impl '_ + Fn(TilePos) -> isize {

pub fn worker_cost_fn(map: &Tilemap) -> impl '_ + Fn(TilePos) -> isize {
move |pos| {
let Some(row) = map.tiles.get(pos.x) else {
return -1;
};
let Some(tile) = row.get(pos.y) else {
let Some(tile) = map.get(pos) else {
return -1;
};

Expand Down
2 changes: 1 addition & 1 deletion src/tilemap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ pub struct TilePos {
pub x: usize,
pub y: usize,
}
impl TilePos {}
impl Into<Vec2> for TilePos {
fn into(self) -> Vec2 {
Vec2::new(self.x as f32, self.y as f32)
Expand Down Expand Up @@ -278,6 +277,7 @@ impl Into<(isize, isize)> for TilePos {
(self.x as isize, self.y as isize)
}
}

#[derive(Resource)]
pub struct TilemapHandle(pub Handle<Tilemap>);

Expand Down

0 comments on commit 22d8d1f

Please sign in to comment.