changeset 1210:8ff88e39e097

fix for crash on main menu
author zipi
date Sun, 09 Jun 2013 11:27:57 +0100
parents decc0dd6e4ba
children 746f7ef994cb be76a797780e
files GUIWindow.cpp
diffstat 1 files changed, 12 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- 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;
 }