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 21:34:09 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-05-30 21:34:09 +0200
commit9684f90f8361fb314a60a387dc9ecf9bc4c3062a (patch)
tree37e595d7f4b6fdd51b18943db2be6b538ea1caea /source/Player.cpp
parentProtoProxy: Added a note in the documentation about the need to switch off username verification (diff)
downloadcuberite-9684f90f8361fb314a60a387dc9ecf9bc4c3062a.tar
cuberite-9684f90f8361fb314a60a387dc9ecf9bc4c3062a.tar.gz
cuberite-9684f90f8361fb314a60a387dc9ecf9bc4c3062a.tar.bz2
cuberite-9684f90f8361fb314a60a387dc9ecf9bc4c3062a.tar.lz
cuberite-9684f90f8361fb314a60a387dc9ecf9bc4c3062a.tar.xz
cuberite-9684f90f8361fb314a60a387dc9ecf9bc4c3062a.tar.zst
cuberite-9684f90f8361fb314a60a387dc9ecf9bc4c3062a.zip
Diffstat (limited to '')
-rw-r--r--source/Player.cpp29
1 files changed, 23 insertions, 6 deletions
diff --git a/source/Player.cpp b/source/Player.cpp
index d659c949a..254e58655 100644
--- a/source/Player.cpp
+++ b/source/Player.cpp
@@ -128,7 +128,7 @@ void cPlayer::Initialize( cWorld* a_World )
void cPlayer::Destroyed()
{
- CloseWindow(-1);
+ CloseWindow();
m_ClientHandle = NULL;
}
@@ -433,9 +433,9 @@ Vector3d cPlayer::GetEyePosition()
-void cPlayer::OpenWindow( cWindow* a_Window )
+void cPlayer::OpenWindow(cWindow * a_Window)
{
- CloseWindow(m_CurrentWindow ? (char)m_CurrentWindow->GetWindowType() : 0);
+ CloseWindow();
a_Window->OpenedByPlayer(*this);
m_CurrentWindow = a_Window;
}
@@ -444,12 +444,29 @@ void cPlayer::OpenWindow( cWindow* a_Window )
-void cPlayer::CloseWindow(char a_WindowType)
+void cPlayer::CloseWindow(void)
{
- if (m_CurrentWindow != NULL)
+ if (m_CurrentWindow == NULL)
{
- m_CurrentWindow->ClosedByPlayer(*this);
+ m_CurrentWindow = m_InventoryWindow;
+ return;
+ }
+
+ m_CurrentWindow->ClosedByPlayer(*this);
+ m_CurrentWindow = m_InventoryWindow;
+}
+
+
+
+
+
+void cPlayer::CloseWindowIfID(char a_WindowID)
+{
+ if ((m_CurrentWindow == NULL) || (m_CurrentWindow->GetWindowID() != a_WindowID))
+ {
+ return;
}
+ m_CurrentWindow->ClosedByPlayer(*this);
m_CurrentWindow = m_InventoryWindow;
}