diff options
author | Tim Angus <tim@ngus.net> | 2009-11-16 21:53:48 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:17:20 +0000 |
commit | 5a2681894642f0b116d5abc248ca17208362fe18 (patch) | |
tree | e31643e32f2586ce37d147e49fda78f8224a4971 | |
parent | 21674b587ca1aa1e956b66ae6e613d5afb2111d3 (diff) |
* Fix draw order bug in r1922 resulting from differing qsort implementations
-rw-r--r-- | assets/ui/options.menu | 1 | ||||
-rw-r--r-- | src/ui/ui_shared.c | 35 |
2 files changed, 16 insertions, 20 deletions
diff --git a/assets/ui/options.menu b/assets/ui/options.menu index fc405a1a..af9b22d3 100644 --- a/assets/ui/options.menu +++ b/assets/ui/options.menu @@ -93,6 +93,7 @@ textscale .25 forecolor 1 1 1 1 visible MENU_TRUE + decoration } itemDef diff --git a/src/ui/ui_shared.c b/src/ui/ui_shared.c index 2199a449..9c958d9a 100644 --- a/src/ui/ui_shared.c +++ b/src/ui/ui_shared.c @@ -1238,25 +1238,10 @@ void Menu_AspectCompensate( menuDef_t *menu ) } } -static int Menu_CompareItemTypes( const void *a, const void *b ) -{ - itemDef_t *itemA = *(itemDef_t **)a; - itemDef_t *itemB = *(itemDef_t **)b; - qboolean itemAIsList = Item_IsListBox( itemA ); - qboolean itemBIsList = Item_IsListBox( itemB ); - - if( itemAIsList && itemBIsList ) - return 0; - else if( itemAIsList ) - return 1; - else if( itemBIsList ) - return -1; - else - return 0; -} - void Menu_PostParse( menuDef_t *menu ) { + int i, j; + if( menu == NULL ) return; @@ -1271,10 +1256,20 @@ void Menu_PostParse( menuDef_t *menu ) Menu_AspectCompensate( menu ); Menu_UpdatePosition( menu ); - // Sort lists to the end of the array as they can potentially be drawn on top + // Push lists to the end of the array as they can potentially be drawn on top // of other elements - if( menu->itemCount > 1 ) - qsort( menu->items, menu->itemCount, sizeof( itemDef_t* ), Menu_CompareItemTypes ); + for( i = 0; i < menu->itemCount; i++ ) + { + itemDef_t *item = menu->items[ i ]; + + if( Item_IsListBox( item ) ) + { + for( j = i; j < menu->itemCount - 1; j++ ) + menu->items[ j ] = menu->items[ j + 1 ]; + + menu->items[ j ] = item; + } + } } itemDef_t *Menu_ClearFocus( menuDef_t *menu ) |