diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-04-30 17:58:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-30 17:58:06 +0200 |
commit | 87e8e71190470b0cbea528376f18743c346aceed (patch) | |
tree | c1dcb1d45856d96729e8f1d914c482bb8187de65 /scene/2d/ray_cast_2d.cpp | |
parent | 66f696c2c16af1d88a016cc725fd10cac79bb838 (diff) | |
parent | efcb097674b085aeabffa568780130c5ff2e6bed (diff) |
Merge pull request #34823 from qarmin/collision_mask_layer
Prevent setting too big or too small Collision Mask and Layer
Diffstat (limited to 'scene/2d/ray_cast_2d.cpp')
-rw-r--r-- | scene/2d/ray_cast_2d.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/scene/2d/ray_cast_2d.cpp b/scene/2d/ray_cast_2d.cpp index 50625a0f39..f6740040c1 100644 --- a/scene/2d/ray_cast_2d.cpp +++ b/scene/2d/ray_cast_2d.cpp @@ -55,6 +55,7 @@ uint32_t RayCast2D::get_collision_mask() const { } void RayCast2D::set_collision_mask_bit(int p_bit, bool p_value) { + ERR_FAIL_INDEX_MSG(p_bit, 32, "Collision mask bit must be between 0 and 31 inclusive."); uint32_t mask = get_collision_mask(); if (p_value) { mask |= 1 << p_bit; @@ -65,6 +66,7 @@ void RayCast2D::set_collision_mask_bit(int p_bit, bool p_value) { } bool RayCast2D::get_collision_mask_bit(int p_bit) const { + ERR_FAIL_INDEX_V_MSG(p_bit, 32, false, "Collision mask bit must be between 0 and 31 inclusive."); return get_collision_mask() & (1 << p_bit); } |