#include "Entity.hpp"
#include "Generator.hpp"
+#include <cstdint>
#include <list>
#include <string>
#include <vector>
/// 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<Entity *> &Players() const noexcept { return players; }
const std::list<Entity> &Entities() const noexcept { return entities; }
void Render(Viewport &);
+private:
+ using EntityHandle = std::list<Entity>::iterator;
+ EntityHandle RemoveEntity(EntityHandle &);
+
private:
Config config;