Fix regressions

This commit is contained in:
Eduardo Bart 2012-08-21 00:36:14 -03:00
parent 66760656e9
commit c185e709b3
2 changed files with 27 additions and 12 deletions

View File

@ -692,7 +692,7 @@ LRESULT WIN32Window::windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
} }
case WM_GETMINMAXINFO: { case WM_GETMINMAXINFO: {
LPMINMAXINFO pMMI = (LPMINMAXINFO)lParam; 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.x = adjustedRect.width();
pMMI->ptMinTrackSize.y = adjustedRect.height(); pMMI->ptMinTrackSize.y = adjustedRect.height();
break; break;
@ -966,18 +966,26 @@ std::string WIN32Window::getPlatformType()
Rect WIN32Window::getClientRect() Rect WIN32Window::getClientRect()
{ {
RECT clientRect = {0,0,0,0}; if(m_window) {
int ret = GetClientRect(m_window, &clientRect); RECT clientRect = {0,0,0,0};
assert(ret != 0); int ret = GetClientRect(m_window, &clientRect);
return Rect(Point(clientRect.left, clientRect.top), Point(clientRect.right, clientRect.bottom)); 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 WIN32Window::getWindowRect()
{ {
RECT windowRect = {0,0,0,0}; if(m_window) {
int ret = GetWindowRect(m_window, &windowRect); RECT windowRect = {0,0,0,0};
assert(ret != 0); int ret = GetWindowRect(m_window, &windowRect);
return Rect(Point(windowRect.left, windowRect.top), Point(windowRect.right, windowRect.bottom)); 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) Rect WIN32Window::adjustWindowRect(const Rect& clientRect)

View File

@ -514,10 +514,17 @@ void Creature::setDirection(Otc::Direction direction)
void Creature::setOutfit(const Outfit& outfit) void Creature::setOutfit(const Outfit& outfit)
{ {
if(!g_things.isValidDatId(outfit.getCategory() == ThingCategoryCreature ? outfit.getId() : outfit.getAuxId(), outfit.getCategory())) if(outfit.getCategory() != ThingCategoryCreature) {
return; 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_walkAnimationPhase = 0; // might happen when player is walking and outfit is changed.
m_outfit = outfit;
} }
void Creature::setSpeed(uint16 speed) void Creature::setSpeed(uint16 speed)