summaryrefslogtreecommitdiff
path: root/server/bot/src
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-08-11 18:53:15 +0200
committermetamuffin <metamuffin@disroot.org>2024-08-11 18:53:15 +0200
commit012fbc3e6382a92de60a191690000b0e83653cc6 (patch)
treedf034266a59087921af33494bbe2a2e163a37ebf /server/bot/src
parentf78568656ffe39f7cc4db293570e29900cffc6f2 (diff)
downloadhurrycurry-012fbc3e6382a92de60a191690000b0e83653cc6.tar
hurrycurry-012fbc3e6382a92de60a191690000b0e83653cc6.tar.bz2
hurrycurry-012fbc3e6382a92de60a191690000b0e83653cc6.tar.zst
Revert "find path with distance"
This reverts commit f78568656ffe39f7cc4db293570e29900cffc6f2.
Diffstat (limited to 'server/bot/src')
-rw-r--r--server/bot/src/pathfinding.rs9
1 files changed, 2 insertions, 7 deletions
diff --git a/server/bot/src/pathfinding.rs b/server/bot/src/pathfinding.rs
index d0c6c8ef..87ccf391 100644
--- a/server/bot/src/pathfinding.rs
+++ b/server/bot/src/pathfinding.rs
@@ -42,12 +42,7 @@ impl Path {
}
}
-pub fn find_path(
- walkable: &HashSet<IVec2>,
- from: IVec2,
- to: IVec2,
- dist_squared: i32,
-) -> Option<Path> {
+pub fn find_path(walkable: &HashSet<IVec2>, from: IVec2, to: IVec2) -> Option<Path> {
#[derive(Debug, PartialEq, Eq)]
struct Open(i32, IVec2, IVec2, i32);
impl PartialOrd for Open {
@@ -71,7 +66,7 @@ pub fn find_path(
continue;
}
visited.insert(pos, f);
- if pos.distance_squared(to) <= dist_squared {
+ if pos == to {
break;
}
for dir in [IVec2::NEG_X, IVec2::NEG_Y, IVec2::X, IVec2::Y] {