summaryrefslogtreecommitdiffstats
path: root/src/Bindings/LuaWindow.cpp
diff options
context:
space:
mode:
authorLogicParrot <LogicParrot@users.noreply.github.com>2017-09-02 09:45:06 +0200
committerAlexander Harkness <me@bearbin.net>2017-09-02 09:50:23 +0200
commit49c443896dcac8c4eaf08c4024e8bd2366ad899a (patch)
treeb1ec46cab2b4e5731860c7136f1bbfca6fe9d458 /src/Bindings/LuaWindow.cpp
parentSetSwimState now takes into account head height (diff)
downloadcuberite-49c443896dcac8c4eaf08c4024e8bd2366ad899a.tar
cuberite-49c443896dcac8c4eaf08c4024e8bd2366ad899a.tar.gz
cuberite-49c443896dcac8c4eaf08c4024e8bd2366ad899a.tar.bz2
cuberite-49c443896dcac8c4eaf08c4024e8bd2366ad899a.tar.lz
cuberite-49c443896dcac8c4eaf08c4024e8bd2366ad899a.tar.xz
cuberite-49c443896dcac8c4eaf08c4024e8bd2366ad899a.tar.zst
cuberite-49c443896dcac8c4eaf08c4024e8bd2366ad899a.zip
Diffstat (limited to 'src/Bindings/LuaWindow.cpp')
-rw-r--r--src/Bindings/LuaWindow.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/Bindings/LuaWindow.cpp b/src/Bindings/LuaWindow.cpp
index ae390e576..2802c69db 100644
--- a/src/Bindings/LuaWindow.cpp
+++ b/src/Bindings/LuaWindow.cpp
@@ -54,15 +54,22 @@ cLuaWindow::~cLuaWindow()
m_Contents.RemoveListener(*this);
// Close open lua window from players, to avoid dangling pointers
- cRoot::Get()->ForEachPlayer([this](cPlayer & a_Player)
+ class cPlayerCallback : public cPlayerListCallback
+ {
+ virtual bool Item(cPlayer * a_Player)
{
- if (a_Player.GetWindow() == this)
+ if (a_Player->GetWindow() == m_LuaWindow)
{
- 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.