Working on reimplementing the player characters
I've also added EraseIf() to the manager classes.
This commit is contained in:
@@ -38,12 +38,23 @@ int ClientManager::HandleDisconnection(int i) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
void ClientManager::ForEach(Lambda fn) {
|
||||
void ClientManager::ForEach(std::function<void(Iterator)> fn) {
|
||||
for(Iterator it = clientMap.begin(); it != clientMap.end(); it++) {
|
||||
fn(it);
|
||||
}
|
||||
}
|
||||
|
||||
void ClientManager::EraseIf(std::function<bool(Iterator)> fn) {
|
||||
for(Iterator it = clientMap.begin(); it != clientMap.end(); /* empty */) {
|
||||
if(fn(it)) {
|
||||
it = clientMap.erase(it);
|
||||
}
|
||||
else {
|
||||
++it;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ClientEntry* ClientManager::GetClient(int i) {
|
||||
for (auto& it : clientMap) {
|
||||
if (it.first == i) {
|
||||
|
||||
Reference in New Issue
Block a user