summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-04-10 16:44:18 +0200
committerStanislaw Halik <sthalik@misaki.pl>2023-04-10 16:45:15 +0200
commit5fc2c1c191440e876a26696d8879110dacf63145 (patch)
treed55e92c605e34f36ba1850b56f8eaf0f1c004c96
parent7faafed3101f899dd1a3f12812d54448485ef735 (diff)
editor: no need to goto start in update_world()
-rw-r--r--editor/update.cpp19
-rw-r--r--src/entity.hpp1
2 files changed, 3 insertions, 17 deletions
diff --git a/editor/update.cpp b/editor/update.cpp
index 630d1397..0b82c099 100644
--- a/editor/update.cpp
+++ b/editor/update.cpp
@@ -190,8 +190,8 @@ void app::apply_commands(const key_set& keys)
void app::update_world(float dt)
{
auto& world = M->world();
- const auto curframe = world.increment_frame_no();
auto [z_min, z_max] = get_z_bounds();
+ world.increment_frame_no();
auto [minx, maxx, miny, maxy] = M->get_draw_bounds();
minx--; miny--; maxx++; maxy++;
for (int8_t z = z_min; z <= z_max; z++)
@@ -203,22 +203,9 @@ void app::update_world(float dt)
continue;
auto& c = *c_;
const auto& es = c.entities();
-start: const auto size = es.size();
+ const auto size = es.size();
for (auto i = size-1; i != (size_t)-1; i--)
- {
- auto& e = *es[i];
- using last_update_type = std::decay_t<decltype(e.last_update)>;
- if (last_update_type(curframe) != e.last_update) [[likely]]
- {
- e.last_update = last_update_type(curframe);
- auto status = e.update(i, dt);
- if (status)
- {
- //Debug{} << "goto start";
- goto start;
- }
- }
- }
+ (void)es[i]->update(i, dt);
}
}
diff --git a/src/entity.hpp b/src/entity.hpp
index 4972767c..8d56617c 100644
--- a/src/entity.hpp
+++ b/src/entity.hpp
@@ -46,7 +46,6 @@ struct entity
const Vector2b offset, bbox_offset;
const Vector2ub bbox_size;
uint16_t delta = 0, frame = 0;
- uint8_t last_update = 0;
const rotation r = rotation::N;
const pass_mode pass = pass_mode::see_through;