summaryrefslogtreecommitdiffstats
path: root/src/Bindings/LuaWindow.cpp
diff options
context:
space:
mode:
authorpeterbell10 <peterbell10@live.co.uk>2017-09-11 23:20:49 +0200
committerMattes D <github@xoft.cz>2017-09-11 23:20:49 +0200
commite225b7f8262df48ad4d7094bc295add3007b0649 (patch)
treea42e9afcc88cfe6e9d1258458e3ad42764083d0e /src/Bindings/LuaWindow.cpp
parentcBlockArea: change MakeIndex to return size_t (diff)
downloadcuberite-e225b7f8262df48ad4d7094bc295add3007b0649.tar
cuberite-e225b7f8262df48ad4d7094bc295add3007b0649.tar.gz
cuberite-e225b7f8262df48ad4d7094bc295add3007b0649.tar.bz2
cuberite-e225b7f8262df48ad4d7094bc295add3007b0649.tar.lz
cuberite-e225b7f8262df48ad4d7094bc295add3007b0649.tar.xz
cuberite-e225b7f8262df48ad4d7094bc295add3007b0649.tar.zst
cuberite-e225b7f8262df48ad4d7094bc295add3007b0649.zip
Diffstat (limited to 'src/Bindings/LuaWindow.cpp')
-rw-r--r--src/Bindings/LuaWindow.cpp15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/Bindings/LuaWindow.cpp b/src/Bindings/LuaWindow.cpp
index 2802c69db..ae390e576 100644
--- a/src/Bindings/LuaWindow.cpp
+++ b/src/Bindings/LuaWindow.cpp
@@ -54,22 +54,15 @@ cLuaWindow::~cLuaWindow()
m_Contents.RemoveListener(*this);
// Close open lua window from players, to avoid dangling pointers
- class cPlayerCallback : public cPlayerListCallback
- {
- virtual bool Item(cPlayer * a_Player)
+ cRoot::Get()->ForEachPlayer([this](cPlayer & a_Player)
{
- if (a_Player->GetWindow() == m_LuaWindow)
+ if (a_Player.GetWindow() == this)
{
- a_Player->CloseWindow(false);
+ a_Player.CloseWindow(false);
}
return false;
}
- cLuaWindow * m_LuaWindow;
- public:
- cPlayerCallback(cLuaWindow & a_LuaWindow) { m_LuaWindow = &a_LuaWindow; }
- } PlayerCallback(*this);
-
- cRoot::Get()->ForEachPlayer(PlayerCallback);
+ );
// Must delete slot areas now, because they are referencing this->m_Contents and would try to access it in cWindow's
// destructor, when the member is already gone.