diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-04-09 18:17:41 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-04-09 18:22:49 +0200 |
commit | aa49d7678b304d3db17f3b51107fcbcfa6dc3ee2 (patch) | |
tree | 34fa456b56775d42991494218aa145a887c83ec0 | |
parent | 5de12ad31bd021b377ac4f96cd4c733026e1b23a (diff) |
src: make struct entity smaller
-rw-r--r-- | editor/update.cpp | 6 | ||||
-rw-r--r-- | src/entity.hpp | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/editor/update.cpp b/editor/update.cpp index 63cc7a3c..41e5fde4 100644 --- a/editor/update.cpp +++ b/editor/update.cpp @@ -203,10 +203,10 @@ start: const auto size = es.size(); for (auto i = size-1; i != (size_t)-1; i--) { auto& e = *es[i]; - fm_debug_assert(!(e.last_update > curframe)); - if (curframe > e.last_update) [[likely]] + using last_update_type = std::decay_t<decltype(e.last_update)>; + if (last_update_type(curframe) != e.last_update) [[likely]] { - e.last_update = curframe; + e.last_update = last_update_type(curframe); auto status = e.update(i, dt); if (status) { diff --git a/src/entity.hpp b/src/entity.hpp index 409d0354..4972767c 100644 --- a/src/entity.hpp +++ b/src/entity.hpp @@ -40,13 +40,13 @@ struct entity fm_DECLARE_DELETED_COPY_ASSIGNMENT(entity); const object_id id = 0; - uint64_t last_update = 0; struct chunk* const c; const std::shared_ptr<anim_atlas> atlas; const global_coords coord; 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; |