summaryrefslogtreecommitdiffhomepage
path: root/src/world.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/world.cpp')
-rw-r--r--src/world.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/world.cpp b/src/world.cpp
index ee1ef459..8743981f 100644
--- a/src/world.cpp
+++ b/src/world.cpp
@@ -106,15 +106,19 @@ void world::collect(bool force)
fm_debug("world: collected %zu/%zu chunks", len, len0);
}
-void world::do_make_entity(const std::shared_ptr<entity>& e, global_coords pos)
+void world::do_make_entity(const std::shared_ptr<entity>& e, global_coords pos, bool sorted)
{
- fm_debug_assert(e->id > 0);
+ fm_assert(e->id > 0);
fm_debug_assert(e->c->world()._unique_id == _unique_id);
+ fm_assert(!_entities.contains(e->id));
fm_assert(Vector2ui(e->bbox_size).product() > 0);
fm_assert(e->type != entity_type::none);
e->coord = pos;
_entities[e->id] = e;
- e->c->add_entity(e);
+ if (sorted)
+ e->c->add_entity(e);
+ else
+ e->c->add_entity_unsorted(e);
}
void world::do_kill_entity(std::uint64_t id)