From 0592e91d317ad7bd3224d169dc9b06f438732f30 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 21 Mar 2023 12:38:27 +0100 Subject: src/entity: simplify update() return value --- src/entity.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/entity.cpp') diff --git a/src/entity.cpp b/src/entity.cpp index ff0f77a9..4ecd950e 100644 --- a/src/entity.cpp +++ b/src/entity.cpp @@ -153,10 +153,10 @@ bool entity::can_move_to(Vector2i delta) return can_move_to(delta, coord, offset, bbox_offset, bbox_size); } -size_t entity::move_to(size_t i, Vector2i delta, rotation new_r) +bool entity::move_to(size_t& i, Vector2i delta, rotation new_r) { if (!can_rotate(new_r)) - return i; + return false; auto& es = c->_entities; fm_debug_assert(i < es.size()); @@ -167,7 +167,7 @@ size_t entity::move_to(size_t i, Vector2i delta, rotation new_r) const auto [coord_, offset_] = normalize_coords(coord, offset, delta); if (coord_ == coord && offset_ == offset) - return i; + return false; if (!is_dynamic()) c->mark_scenery_modified(); @@ -186,7 +186,7 @@ size_t entity::move_to(size_t i, Vector2i delta, rotation new_r) const_cast(r) = new_r; //for (auto i = 0_uz; const auto& x : es) fm_debug("%zu %s %f", i++, x->atlas->name().data(), x->ordinal()); //fm_debug("insert (%hd;%hd|%hhd;%hhd) %td -> %zu | %f", coord_.chunk().x, coord_.chunk().y, coord_.local().x, coord_.local().y, pos1, es.size(), e.ordinal()); - return i; + return false; } else { @@ -204,7 +204,7 @@ size_t entity::move_to(size_t i, Vector2i delta, rotation new_r) const_cast(r) = new_r; const_cast(c) = &c2; es.insert(it, std::move(e_)); - return ret; + return true; } } -- cgit v1.2.3