mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-17 03:20:06 +00:00
38 lines
974 B
C++
38 lines
974 B
C++
#pragma once
|
|
|
|
#include "Entities.hpp"
|
|
|
|
#include <vector>
|
|
#include <map>
|
|
#include <list>
|
|
|
|
/* forward declaration(s) */
|
|
struct Player;
|
|
|
|
struct Group {
|
|
std::vector<EntityRef> members;
|
|
|
|
std::vector<EntityRef> filter(EntityKind kind) {
|
|
std::vector<EntityRef> filtered;
|
|
std::copy_if(members.begin(), members.end(), std::back_inserter(filtered), [kind](EntityRef e) {
|
|
return e.kind == kind;
|
|
});
|
|
return filtered;
|
|
}
|
|
|
|
Group(EntityRef leader);
|
|
};
|
|
|
|
namespace Groups {
|
|
void init();
|
|
|
|
void sendToGroup(Group* group, void* buf, uint32_t type, size_t size);
|
|
void sendToGroup(Group* group, EntityRef excluded, void* buf, uint32_t type, size_t size);
|
|
void groupTickInfo(CNSocket* sock);
|
|
|
|
void groupKick(Group* group, EntityRef ref);
|
|
void addToGroup(Group* group, EntityRef member);
|
|
bool removeFromGroup(Group* group, EntityRef member); // true iff group deleted
|
|
void disbandGroup(Group* group);
|
|
}
|