summaryrefslogtreecommitdiffstats
path: root/source/Player.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-05-30 22:40:43 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-05-30 22:40:43 +0200
commit2eb1240e14986e1cccc02a96713133a003347f8b (patch)
tree28c58a677423d507ab57e421b9fcb8df8b31c5e0 /source/Player.cpp
parentWindow contents are sent whenever the window is opened by a player. (diff)
downloadcuberite-2eb1240e14986e1cccc02a96713133a003347f8b.tar
cuberite-2eb1240e14986e1cccc02a96713133a003347f8b.tar.gz
cuberite-2eb1240e14986e1cccc02a96713133a003347f8b.tar.bz2
cuberite-2eb1240e14986e1cccc02a96713133a003347f8b.tar.lz
cuberite-2eb1240e14986e1cccc02a96713133a003347f8b.tar.xz
cuberite-2eb1240e14986e1cccc02a96713133a003347f8b.tar.zst
cuberite-2eb1240e14986e1cccc02a96713133a003347f8b.zip
Diffstat (limited to '')
-rw-r--r--source/Player.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/source/Player.cpp b/source/Player.cpp
index 8970719f1..519837f6a 100644
--- a/source/Player.cpp
+++ b/source/Player.cpp
@@ -435,7 +435,10 @@ Vector3d cPlayer::GetEyePosition()
void cPlayer::OpenWindow(cWindow * a_Window)
{
- CloseWindow();
+ if (a_Window != m_CurrentWindow)
+ {
+ CloseWindow();
+ }
a_Window->OpenedByPlayer(*this);
m_CurrentWindow = a_Window;
a_Window->SendWholeWindow(*GetClientHandle());
@@ -453,8 +456,17 @@ void cPlayer::CloseWindow(void)
return;
}
- m_CurrentWindow->ClosedByPlayer(*this);
- m_CurrentWindow = m_InventoryWindow;
+ if (m_CurrentWindow->ClosedByPlayer(*this))
+ {
+ // Close accepted, go back to inventory window (the default):
+ m_CurrentWindow = m_InventoryWindow;
+ }
+ else
+ {
+ // Re-open the window
+ m_CurrentWindow->OpenedByPlayer(*this);
+ m_CurrentWindow->SendWholeWindow(*GetClientHandle());
+ }
}
@@ -467,8 +479,7 @@ void cPlayer::CloseWindowIfID(char a_WindowID)
{
return;
}
- m_CurrentWindow->ClosedByPlayer(*this);
- m_CurrentWindow = m_InventoryWindow;
+ CloseWindow();
}