summaryrefslogtreecommitdiff
path: root/battles/src/TeamManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'battles/src/TeamManager.cpp')
-rw-r--r--battles/src/TeamManager.cpp62
1 files changed, 0 insertions, 62 deletions
diff --git a/battles/src/TeamManager.cpp b/battles/src/TeamManager.cpp
deleted file mode 100644
index 9dc90e3..0000000
--- a/battles/src/TeamManager.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-#include "TeamManager.h"
-
-#include <algorithm>
-#include <random>
-#include <utility>
-#include <vector>
-
-#include <entt/entity/registry.hpp>
-
-
-namespace kurator
-{
-namespace battles
-{
-
-
-TeamManager::TeamManager() :
- teams {},
- generator {std::random_device{}()}
-{
-}
-
-
-void
-TeamManager::add(int team, entt::entity entity)
-{
- for (int i = teams.size(); i < team + 1; ++i)
- teams.emplace_back();
- teams.at(team).push_back(std::move(entity));
-}
-
-
-TeamManager::Team
-TeamManager::get(int team) const
-{
- return teams.at(team);
-}
-
-
-entt::entity
-TeamManager::random(int team)
-{
- auto& members = teams.at(team);
- if (members.size() == 0)
- return entt::null;
- std::uniform_int_distribution<Team::size_type> uniform{0, members.size() - 1};
- return members.at(uniform(generator));
-}
-
-
-void
-TeamManager::clear(entt::registry& registry)
-{
- for (auto& members : teams) {
- auto is_valid = [&registry](entt::entity entity){ return !registry.valid(entity); };
- members.erase(std::remove_if(members.begin(), members.end(), is_valid), members.end());
- }
-}
-
-
-} // namespace battles
-} // namespace kurator