X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fworld%2FWorld.hpp;h=9739e21f18415eff4df70010fe9b588d82ba332b;hb=99345b497912db65204d48348140fc774dcb6989;hp=7d2c2926a1732ee4ea5f663cd112f3de6dd4335a;hpb=da5073a7fdb1ca066e778a02db33d5d15073aea0;p=blank.git diff --git a/src/world/World.hpp b/src/world/World.hpp index 7d2c292..9739e21 100644 --- a/src/world/World.hpp +++ b/src/world/World.hpp @@ -5,6 +5,7 @@ #include "Entity.hpp" #include "Generator.hpp" +#include #include #include #include @@ -70,7 +71,14 @@ public: /// add player with given name /// returns nullptr if the name is already taken Entity *AddPlayer(const std::string &name); - Entity &AddEntity() { entities.emplace_back(); return entities.back(); } + /// add player with given name and ID + /// returns nullptr if the name or ID is already taken + Entity *AddPlayer(const std::string &name, std::uint32_t id); + /// add an entity with an autogenerated ID + Entity &AddEntity(); + /// add entity with given ID + /// returns nullptr if the ID is already taken + Entity *AddEntity(std::uint32_t id); const std::vector &Players() const noexcept { return players; } const std::list &Entities() const noexcept { return entities; } @@ -79,6 +87,10 @@ public: void Render(Viewport &); +private: + using EntityHandle = std::list::iterator; + EntityHandle RemoveEntity(EntityHandle &); + private: Config config;