mirror of
https://github.com/alterware/master-server.git
synced 2026-03-10 18:53:02 +00:00
init
This commit is contained in:
38
src/client_list.cpp
Normal file
38
src/client_list.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
#include "std_include.hpp"
|
||||
#include "client_list.hpp"
|
||||
|
||||
bool client_list::find_client(const uint64_t guid, const access_func& accessor)
|
||||
{
|
||||
auto found = false;
|
||||
|
||||
this->iterate([&](iteration_context& context)
|
||||
{
|
||||
auto& client = context.get();
|
||||
if (client.guid == guid)
|
||||
{
|
||||
accessor(client, context.get_address());
|
||||
context.stop_iterating();
|
||||
found = true;
|
||||
}
|
||||
});
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
bool client_list::find_client(const uint64_t guid, const const_access_func& accessor) const
|
||||
{
|
||||
auto found = false;
|
||||
|
||||
this->iterate([&](const iteration_context& context)
|
||||
{
|
||||
const auto& client = context.get();
|
||||
if (client.guid == guid)
|
||||
{
|
||||
accessor(client, context.get_address());
|
||||
context.stop_iterating();
|
||||
found = true;
|
||||
}
|
||||
});
|
||||
|
||||
return found;
|
||||
}
|
||||
Reference in New Issue
Block a user