diff options
author | Mattes D <github@xoft.cz> | 2015-04-25 18:58:11 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2015-04-25 18:58:11 +0200 |
commit | 80baa2b0568e38643dada06c684eff45a553dd96 (patch) | |
tree | 91f972f29ef7aa38ceba17e22ae3e81c6c998857 /src | |
parent | Plugin removes its command registrations and webtabs when unloaded. (diff) | |
parent | Eliminate race condition in cRoot::FindAndDoWithPlayer (diff) | |
download | cuberite-80baa2b0568e38643dada06c684eff45a553dd96.tar cuberite-80baa2b0568e38643dada06c684eff45a553dd96.tar.gz cuberite-80baa2b0568e38643dada06c684eff45a553dd96.tar.bz2 cuberite-80baa2b0568e38643dada06c684eff45a553dd96.tar.lz cuberite-80baa2b0568e38643dada06c684eff45a553dd96.tar.xz cuberite-80baa2b0568e38643dada06c684eff45a553dd96.tar.zst cuberite-80baa2b0568e38643dada06c684eff45a553dd96.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Root.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Root.cpp b/src/Root.cpp index 690bd7357..1379b01a2 100644 --- a/src/Root.cpp +++ b/src/Root.cpp @@ -607,7 +607,7 @@ bool cRoot::FindAndDoWithPlayer(const AString & a_PlayerName, cPlayerListCallbac size_t Rating = RateCompareString (m_PlayerName, a_pPlayer->GetName()); if ((Rating > 0) && (Rating >= m_BestRating)) { - m_BestMatch = a_pPlayer; + m_BestMatch = a_pPlayer->GetName(); if (Rating > m_BestRating) { m_NumMatches = 0; @@ -627,18 +627,18 @@ bool cRoot::FindAndDoWithPlayer(const AString & a_PlayerName, cPlayerListCallbac m_BestRating(0), m_NameLength(a_PlayerName.length()), m_PlayerName(a_PlayerName), - m_BestMatch(nullptr), + m_BestMatch(), m_NumMatches(0) {} - cPlayer * m_BestMatch; + AString m_BestMatch; unsigned m_NumMatches; } Callback (a_PlayerName); ForEachPlayer(Callback); if (Callback.m_NumMatches == 1) { - return a_Callback.Item(Callback.m_BestMatch); + return DoWithPlayer(Callback.m_BestMatch, a_Callback); } return false; } |