From c185e709b30ce61744e4cd526825aad37c542ba6 Mon Sep 17 00:00:00 2001 From: Eduardo Bart Date: Tue, 21 Aug 2012 00:36:14 -0300 Subject: [PATCH] Fix regressions --- src/framework/platform/win32window.cpp | 26 +++++++++++++++++--------- src/otclient/creature.cpp | 13 ++++++++++--- 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/src/framework/platform/win32window.cpp b/src/framework/platform/win32window.cpp index 02e1967e..b08e0e6c 100644 --- a/src/framework/platform/win32window.cpp +++ b/src/framework/platform/win32window.cpp @@ -692,7 +692,7 @@ LRESULT WIN32Window::windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar } case WM_GETMINMAXINFO: { LPMINMAXINFO pMMI = (LPMINMAXINFO)lParam; - Rect adjustedRect = adjustWindowRect(Rect(getWindowRect().topLeft(), m_minimumSize)); + Rect adjustedRect = adjustWindowRect(Rect(0, 0, m_minimumSize)); pMMI->ptMinTrackSize.x = adjustedRect.width(); pMMI->ptMinTrackSize.y = adjustedRect.height(); break; @@ -966,18 +966,26 @@ std::string WIN32Window::getPlatformType() Rect WIN32Window::getClientRect() { - RECT clientRect = {0,0,0,0}; - int ret = GetClientRect(m_window, &clientRect); - assert(ret != 0); - return Rect(Point(clientRect.left, clientRect.top), Point(clientRect.right, clientRect.bottom)); + if(m_window) { + RECT clientRect = {0,0,0,0}; + int ret = GetClientRect(m_window, &clientRect); + assert(ret != 0); + return Rect(Point(clientRect.left, clientRect.top), Point(clientRect.right, clientRect.bottom)); + } else { + return Rect(m_position, m_size); + } } Rect WIN32Window::getWindowRect() { - RECT windowRect = {0,0,0,0}; - int ret = GetWindowRect(m_window, &windowRect); - assert(ret != 0); - return Rect(Point(windowRect.left, windowRect.top), Point(windowRect.right, windowRect.bottom)); + if(m_window) { + RECT windowRect = {0,0,0,0}; + int ret = GetWindowRect(m_window, &windowRect); + assert(ret != 0); + return Rect(Point(windowRect.left, windowRect.top), Point(windowRect.right, windowRect.bottom)); + } else { + return adjustWindowRect(getClientRect()); + } } Rect WIN32Window::adjustWindowRect(const Rect& clientRect) diff --git a/src/otclient/creature.cpp b/src/otclient/creature.cpp index 59c1c1ff..38af2be8 100644 --- a/src/otclient/creature.cpp +++ b/src/otclient/creature.cpp @@ -514,10 +514,17 @@ void Creature::setDirection(Otc::Direction direction) void Creature::setOutfit(const Outfit& outfit) { - if(!g_things.isValidDatId(outfit.getCategory() == ThingCategoryCreature ? outfit.getId() : outfit.getAuxId(), outfit.getCategory())) - return; + if(outfit.getCategory() != ThingCategoryCreature) { + if(!g_things.isValidDatId(outfit.getAuxId(), outfit.getCategory())) + return; + m_outfit.setAuxId(outfit.getAuxId()); + m_outfit.setCategory(outfit.getCategory()); + } else { + if(!g_things.isValidDatId(outfit.getId(), ThingCategoryCreature)) + return; + m_outfit = outfit; + } m_walkAnimationPhase = 0; // might happen when player is walking and outfit is changed. - m_outfit = outfit; } void Creature::setSpeed(uint16 speed)