summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-07-07 12:38:44 +0200
committerRémi Verschelde <rverschelde@gmail.com>2024-07-07 12:38:44 +0200
commit5bc5ea898c49eaef9df76ff6e5461278f6e6d7e4 (patch)
tree5ee6eaa230a5bb966a2686927428dc34f201155f
parent50373e66eea87c82e18192f1df198f0bb241a208 (diff)
parent453c8753a9ed052d4715387cb11a3c162a829a2d (diff)
downloadredot-engine-5bc5ea898c49eaef9df76ff6e5461278f6e6d7e4.tar.gz
Merge pull request #93993 from Chaosus/astargrid2d_update_fix
Add a check to prevent user to call `AStarGrid2D::update` when its not needed
-rw-r--r--core/math/a_star_grid_2d.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/core/math/a_star_grid_2d.cpp b/core/math/a_star_grid_2d.cpp
index f272407869..984bb1c9c1 100644
--- a/core/math/a_star_grid_2d.cpp
+++ b/core/math/a_star_grid_2d.cpp
@@ -122,6 +122,10 @@ AStarGrid2D::CellShape AStarGrid2D::get_cell_shape() const {
}
void AStarGrid2D::update() {
+ if (!dirty) {
+ return;
+ }
+
points.clear();
const int32_t end_x = region.get_end().x;