# HG changeset patch # User zipi # Date 1370773677 -3600 # Node ID 8ff88e39e09707970f52107c288ed3f9be96c594 # Parent decc0dd6e4ba27a029db7c447ad85219edbdf517 fix for crash on main menu diff -r decc0dd6e4ba -r 8ff88e39e097 GUIWindow.cpp --- a/GUIWindow.cpp Sun Jun 09 13:20:34 2013 +0400 +++ b/GUIWindow.cpp Sun Jun 09 11:27:57 2013 +0100 @@ -159,34 +159,19 @@ v1 = toupper(uHotkey); v2 = uNumVisibleWindows; v3 = v1; - if ( uNumVisibleWindows >= 0 ) + for( v2 = uNumVisibleWindows; v2 >= 0 && pVisibleWindowsIdxs[v2] > 0; v2-- ) { - while ( 2 ) - { - v4 = &pWindowList[pVisibleWindowsIdxs[v2] - 1]; - for ( result = v4->pControlsHead; result; result = result->pNext ) - { - if ( result->uHotkey == v3 ) - { - pMessageQueue_50CBD0->AddMessage(result->msg, result->msg_param, 0); - /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) - { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)result->uControlID; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v6; - *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; - ++pMessageQueue_50CBD0->uNumMessages; - }*/ - return result; - } - } - if ( v4->uFrameX || v4->uFrameY || !(v4->uFrameWidth == 640 && v4->uFrameHeight == 480) ) - { - --v2; - if ( v2 >= 0 ) - continue; - } - break; - } + v4 = &pWindowList[pVisibleWindowsIdxs[v2] - 1]; + for ( result = v4->pControlsHead; result; result = result->pNext ) + { + if ( result->uHotkey == v3 ) + { + pMessageQueue_50CBD0->AddMessage(result->msg, result->msg_param, 0); + return result; + } + } + if ( !v4->uFrameX && !v4->uFrameY && (v4->uFrameWidth == 640 && v4->uFrameHeight == 480) ) + break; } return 0; }