summaryrefslogtreecommitdiffhomepage
path: root/editor
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-03-03 19:40:11 +0100
committerStanislaw Halik <sthalik@misaki.pl>2023-03-03 20:34:02 +0100
commit3d7ae4c401d5bd6109a7fd25eb22e5bc77f0a4aa (patch)
tree7c673746944b85fbafae891ac69594326b15b517 /editor
parent6d0a594e618f165eb2823bb31eb3cfe21ec1e7c5 (diff)
src: rework scenery updates
Diffstat (limited to 'editor')
-rw-r--r--editor/imgui-inspect.cpp2
-rw-r--r--editor/inspect-types.cpp15
-rw-r--r--editor/update.cpp2
3 files changed, 5 insertions, 14 deletions
diff --git a/editor/imgui-inspect.cpp b/editor/imgui-inspect.cpp
index f7543788..b673c9d5 100644
--- a/editor/imgui-inspect.cpp
+++ b/editor/imgui-inspect.cpp
@@ -48,7 +48,7 @@ void app::draw_inspector()
snformat(buf, "{} ({}x{} -> {}x{})"_cf, name, ch.x, ch.y, (int)pos.x, (int)pos.y);
bool is_open = true;
if (auto b2 = begin_window(buf, &is_open))
- c.with_scenery_bbox_update(s.index(), [&] { return entities::inspect_type(s); });
+ c.with_scenery_update(s.index(), [&] { return entities::inspect_type(s); });
if (!is_open)
inspectors.erase(inspectors.begin() + (int)i);
}
diff --git a/editor/inspect-types.cpp b/editor/inspect-types.cpp
index 8f84ebd7..aa6a2faa 100644
--- a/editor/inspect-types.cpp
+++ b/editor/inspect-types.cpp
@@ -43,18 +43,12 @@ struct entity_accessors<scenery_ref> {
},
entity::type<pass_mode>::field{"pass-mode"_s,
[](const scenery_ref& x) { return x.frame.passability; },
- [](scenery_ref& x, pass_mode value) {
- x.chunk().with_scenery_bbox_update(x.index(), [&] {
- x.frame.passability = value;
- });
+ [](scenery_ref& x, pass_mode value) { x.chunk().with_scenery_update(x.index(), [&] { x.frame.passability = value; });
},
},
entity::type<Vector2b>::field{"bbox-offset"_s,
[](const scenery_ref& x) { return x.frame.bbox_offset; },
- [](scenery_ref& x, Vector2b value) {
- x.chunk().with_scenery_bbox_update(x.index(), [&] {
- x.frame.bbox_offset = value;
- });
+ [](scenery_ref& x, Vector2b value) { x.chunk().with_scenery_update(x.index(), [&] { x.frame.bbox_offset = value; });
},
[](const scenery_ref& x) {
return x.frame.passability == pass_mode::pass
@@ -64,10 +58,7 @@ struct entity_accessors<scenery_ref> {
},
entity::type<Vector2ub>::field{"bbox-size"_s,
[](const scenery_ref& x) { return x.frame.bbox_size; },
- [](scenery_ref& x, Vector2ub value) {
- x.chunk().with_scenery_bbox_update(x.index(), [&] {
- x.frame.bbox_size = value;
- });
+ [](scenery_ref& x, Vector2ub value) { x.chunk().with_scenery_update(x.index(), [&] { x.frame.bbox_size = value; });
},
[](const scenery_ref& x) { return x.frame.passability == pass_mode::pass ? field_status::readonly : field_status::enabled; },
},
diff --git a/editor/update.cpp b/editor/update.cpp
index e784ef86..16a155f3 100644
--- a/editor/update.cpp
+++ b/editor/update.cpp
@@ -205,7 +205,7 @@ void app::update_world(float dt)
for (std::int16_t x = minx; x <= maxx; x++)
for (auto& c = world[chunk_coords{x, y}]; auto [x, k, pt] : c)
if (auto sc = x.scenery(); sc && sc.can_activate())
- c.with_scenery_bbox_update(sc.index(), [&] { return sc.update(dt); });
+ c.with_scenery_update(sc.index(), [&] { return sc.update(dt); });
}
void app::set_cursor()