diff options
author | Patrick Dawson <pat@dw.is> | 2020-07-13 01:39:39 +0200 |
---|---|---|
committer | Patrick Dawson <pat@dw.is> | 2020-07-13 16:53:58 +0200 |
commit | 9e28df22a0195340016f3ec7271a0bd738c0e928 (patch) | |
tree | b3bb65103c1c43fd11313362e69fed222a2c4d1c | |
parent | f10f76d95db3248ffb11d2b97b0cdd317b0b5e73 (diff) |
Avoid overflow when calculating visible_cells
-rw-r--r-- | scene/resources/world_2d.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/scene/resources/world_2d.cpp b/scene/resources/world_2d.cpp index 1c753fdb91..d2bc2bea31 100644 --- a/scene/resources/world_2d.cpp +++ b/scene/resources/world_2d.cpp @@ -211,7 +211,7 @@ struct SpatialIndexer2D { List<VisibilityNotifier2D *> added; List<VisibilityNotifier2D *> removed; - int visible_cells = (end.x - begin.x) * (end.y - begin.y); + uint64_t visible_cells = (uint64_t)(end.x - begin.x) * (uint64_t)(end.y - begin.y); if (visible_cells > 10000) { //well you zoomed out a lot, it's your problem. To avoid freezing in the for loops below, we'll manually check cell by cell |