From d8d3b9aec5bbb0f6d632d86f1fb7b1e8f58e9063 Mon Sep 17 00:00:00 2001 From: Vincent Date: Mon, 8 Dec 2014 00:12:48 -0800 Subject: Moved the check into a new function and just calls that function and a blank FindAndDoWithPlayer added. --- src/Root.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/Root.cpp') diff --git a/src/Root.cpp b/src/Root.cpp index e309bb174..e51b7a048 100644 --- a/src/Root.cpp +++ b/src/Root.cpp @@ -649,6 +649,15 @@ bool cRoot::DoWithPlayerByUUID(const AString & a_PlayerUUID, cPlayerListCallback +bool cRoot::FindAndDoWithPlayer(const AString & a_PlayerName, cPlayerListCallback & a_Callback) +{ + +} + + + + + AString cRoot::GetProtocolVersionTextFromInt(int a_ProtocolVersion) { return cProtocolRecognizer::GetVersionTextFromInt(a_ProtocolVersion); -- cgit v1.2.3 From 6de07d4a39096f19c075695824aa87a1907e4edc Mon Sep 17 00:00:00 2001 From: Vincent Date: Mon, 8 Dec 2014 00:45:29 -0800 Subject: Fixed compile errors --- src/Root.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Root.cpp') diff --git a/src/Root.cpp b/src/Root.cpp index e51b7a048..dddb943a2 100644 --- a/src/Root.cpp +++ b/src/Root.cpp @@ -649,7 +649,7 @@ bool cRoot::DoWithPlayerByUUID(const AString & a_PlayerUUID, cPlayerListCallback -bool cRoot::FindAndDoWithPlayer(const AString & a_PlayerName, cPlayerListCallback & a_Callback) +bool cRoot::DoWithPlayer(const AString & a_PlayerName, cPlayerListCallback & a_Callback) { } -- cgit v1.2.3 From e28cc876c4aa4d71f821fca45b5486b8ef6cca4e Mon Sep 17 00:00:00 2001 From: Vincent Date: Mon, 8 Dec 2014 00:57:46 -0800 Subject: created callback in Root and changed CheckMultiLogin() to use the DoWithPlayer function at Root instead of World. --- src/Root.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/Root.cpp') diff --git a/src/Root.cpp b/src/Root.cpp index dddb943a2..c59590d95 100644 --- a/src/Root.cpp +++ b/src/Root.cpp @@ -651,7 +651,14 @@ bool cRoot::DoWithPlayerByUUID(const AString & a_PlayerUUID, cPlayerListCallback bool cRoot::DoWithPlayer(const AString & a_PlayerName, cPlayerListCallback & a_Callback) { - + for (WorldMap::iterator itr = m_WorldsByName.begin(); itr != m_WorldsByName.end(); itr++) + { + if (itr->second->DoWithPlayer(a_PlayerName, a_Callback)) + { + return true; + } + } + return false; } -- cgit v1.2.3 From e9a27db028172b5d964cee4421ed5df3af5a1cf0 Mon Sep 17 00:00:00 2001 From: Vincent Date: Mon, 8 Dec 2014 15:58:46 -0800 Subject: Changed DoWithPlayer to auto instead of using iterator. --- src/Root.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Root.cpp') diff --git a/src/Root.cpp b/src/Root.cpp index c59590d95..2234f7fdc 100644 --- a/src/Root.cpp +++ b/src/Root.cpp @@ -651,9 +651,9 @@ bool cRoot::DoWithPlayerByUUID(const AString & a_PlayerUUID, cPlayerListCallback bool cRoot::DoWithPlayer(const AString & a_PlayerName, cPlayerListCallback & a_Callback) { - for (WorldMap::iterator itr = m_WorldsByName.begin(); itr != m_WorldsByName.end(); itr++) + for (auto World : m_WorldsByName) { - if (itr->second->DoWithPlayer(a_PlayerName, a_Callback)) + if (World.second->DoWithPlayer(a_PlayerName, a_Callback)) { return true; } -- cgit v1.2.3