summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Riedmair <info@zzz-assault.de>2020-05-03 00:27:47 +0200
committerThomas Riedmair <info@zzz-assault.de>2020-05-03 00:27:47 +0200
commite0f084b924fe6e80805005632c6b203014df755b (patch)
tree51f739e8565bddb34ef822ef31404955d39acaa3
parentf5cd33f39df3f4e0b59cf39ed2d8375928b998d9 (diff)
Fix performance issue in update_bitmask_region fallback
-rw-r--r--scene/2d/tile_map.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp
index 9628c01718..86e61fe878 100644
--- a/scene/2d/tile_map.cpp
+++ b/scene/2d/tile_map.cpp
@@ -940,13 +940,10 @@ void TileMap::update_bitmask_area(const Vector2 &p_pos) {
void TileMap::update_bitmask_region(const Vector2 &p_start, const Vector2 &p_end) {
if ((p_end.x < p_start.x || p_end.y < p_start.y) || (p_end.x == p_start.x && p_end.y == p_start.y)) {
- int i;
Array a = get_used_cells();
- for (i = 0; i < a.size(); i++) {
- // update_bitmask_area() in order to update cells adjacent to the
- // current cell, since ordering in array may not be reliable
+ for (int i = 0; i < a.size(); i++) {
Vector2 vector = (Vector2)a[i];
- update_bitmask_area(Vector2(vector.x, vector.y));
+ update_cell_bitmask(vector.x, vector.y);
}
return;
}