Support and General Use > User Interface and Voice

Menu reworking

<< < (11/11)

AM:

--- Quote from: Rincewind on August 19, 2006, 09:57:20 AM ---I just had a thought about alpabetical sorting. It is not possible to do this, because of translations. The menu structure would be complete nonsense in a non-english language if we order the items alphabetical in english.
--- End quote ---
Why would we have to? We should be able to sort the menus in runtime using whatever language is chosen.

Personally I wouldn't want alphabetically sorted menus but for those that do it shouldn't be too hard to make a patch that allows for that option. Hey, I'll even give 'em a headstart: ;)

--- Code: ---void menu_sort_items(struct menu_item* items, int count)
{
    struct menu_item temp;
    int i = 1;
    for(; i<count; i++)
    { 
        int j = i;
        temp = items[i];
        for(; j>=0; j--)
        {
            if( !j || strcmpi( P2STR(items[j-1].desc),
                               P2STR(temp.desc) ) <=0 )
            {
                items[j] = temp;
                break;
            }
            else
                items[j] = items[j-1];
        }
    }
}

--- End code ---

Navigation

[0] Message Index

[*] Previous page

Go to full version