summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/world.cpp6
-rw-r--r--src/world.hpp1
2 files changed, 7 insertions, 0 deletions
diff --git a/src/world.cpp b/src/world.cpp
index 37b78616..f5c378cd 100644
--- a/src/world.cpp
+++ b/src/world.cpp
@@ -105,4 +105,10 @@ void world::do_kill_entity(std::uint64_t id)
fm_debug_assert(cnt > 0);
}
+std::shared_ptr<entity> world::find_entity(std::uint64_t id)
+{
+ auto it = _entities.find(id);
+ return it == _entities.end() ? nullptr : it->second.lock();
+}
+
} // namespace floormat
diff --git a/src/world.hpp b/src/world.hpp
index dfd7a71a..039f3387 100644
--- a/src/world.hpp
+++ b/src/world.hpp
@@ -77,6 +77,7 @@ public:
return ret;
}
+ std::shared_ptr<entity> find_entity(std::uint64_t id);
bool is_teardown() const { return _teardown; }
fm_DECLARE_DEPRECATED_COPY_ASSIGNMENT(world);