From 9684f90f8361fb314a60a387dc9ecf9bc4c3062a Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Thu, 30 May 2013 19:34:09 +0000 Subject: LuaWindow: Initial code, the window can be opened, but not much manipulated git-svn-id: http://mc-server.googlecode.com/svn/trunk@1532 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/Player.cpp | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) (limited to 'source/Player.cpp') 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; } -- cgit v1.2.3