1
0

Replace ItemCallbacks with lambdas (#3948)

This commit is contained in:
peterbell10
2017-09-01 12:04:50 +01:00
committed by Mattes D
parent 09dfe0d811
commit 496c337cdf
67 changed files with 876 additions and 1834 deletions

View File

@@ -1,4 +1,4 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "Window.h"
#include "WindowOwner.h"
@@ -362,12 +362,12 @@ void cWindow::OwnerDestroyed()
bool cWindow::ForEachPlayer(cItemCallback<cPlayer> & a_Callback)
bool cWindow::ForEachPlayer(const cPlayerListCallback & a_Callback)
{
cCSLock Lock(m_CS);
for (cPlayerList::iterator itr = m_OpenedBy.begin(), end = m_OpenedBy.end(); itr != end; ++itr)
for (auto & Player : m_OpenedBy)
{
if (a_Callback.Item(*itr))
if (a_Callback(*Player))
{
return false;
}
@@ -379,12 +379,12 @@ bool cWindow::ForEachPlayer(cItemCallback<cPlayer> & a_Callback)
bool cWindow::ForEachClient(cItemCallback<cClientHandle> & a_Callback)
bool cWindow::ForEachClient(cClientHandleCallback & a_Callback)
{
cCSLock Lock(m_CS);
for (cPlayerList::iterator itr = m_OpenedBy.begin(), end = m_OpenedBy.end(); itr != end; ++itr)
for (auto & Player : m_OpenedBy)
{
if (a_Callback.Item((*itr)->GetClientHandle()))
if (a_Callback(*Player->GetClientHandle()))
{
return false;
}