diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2024-03-24 23:35:45 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2024-03-24 23:36:32 +0100 |
commit | f97fc145a3e70598446c3672dcbb528e181777c1 (patch) | |
tree | 4fb7a8dd29e91a1cd8137fc4cfc0f3f8b526617c | |
parent | 5e3cd10000941574de76620d8d5249924181d824 (diff) |
editor: clamp bbox_size min value to {1,1}
-rw-r--r-- | editor/inspect-types.cpp | 1 | ||||
-rw-r--r-- | src/object.cpp | 2 |
2 files changed, 3 insertions, 0 deletions
diff --git a/editor/inspect-types.cpp b/editor/inspect-types.cpp index c42d4eb4..a06f8fdb 100644 --- a/editor/inspect-types.cpp +++ b/editor/inspect-types.cpp @@ -82,6 +82,7 @@ struct entity_accessors<object, inspect_intent_t> { [](const object& x) { return x.bbox_size; }, [](object& x, Vector2ub value) { x.set_bbox(x.offset, x.bbox_offset, value, x.pass); }, [](const object& x) { return x.pass == pass_mode::pass ? st::readonly : st::enabled; }, + constantly(constraints::range<Vector2ub>{{1,1}, {255, 255}}), }, E::type<bool>::field{"ephemeral"_s, [](const object& x) { return x.ephemeral; }, diff --git a/src/object.cpp b/src/object.cpp index 4339e055..b652a439 100644 --- a/src/object.cpp +++ b/src/object.cpp @@ -348,6 +348,8 @@ object::operator object_proto() const void object::set_bbox(Vector2b offset_, Vector2b bb_offset_, Vector2ub bb_size_, pass_mode pass) { + fm_assert(Vector2ui(bb_size_).product() != 0); + if (offset != offset_) if (!is_dynamic()) c->mark_scenery_modified(); |