Ouchface
Register | User Profile | Member List | F.A.Q | Privacy Policy | New Blog | Search Forums | Forums Home
Doomworld Forums : Powered by vBulletin version 2.2.5 Doomworld Forums > Special Interest > Eternity > Menu Search Feature
 
Author
All times are GMT. The time now is 08:48. Post New Thread    Post A Reply
Quasar
Moderator


Posts: 2202
Registered: 08-00


I've added a console command (and corresponding item on the menus) which allows you to enter a term and then search for occurances of it within the other menus. The next result is returned each time until all matches have been exhausted. The search then gets reset so you can start over if you wish.

I pasted the code just to make this post longer and to piss off people who hate code ^_^ I figured some of you like Joel might be interested to see what was involved in adding such a potentially useful feature.

code:
CONSOLE_COMMAND(mn_search, 0) { int i = 0; menu_t *curMenu; boolean pastLast; // if lastMatch is set, set pastLast to false so that we'll seek // forward until we pass the last item that was matched pastLast = !lastMatch; if(!mn_searchstr || !mn_searchstr[0]) { MN_ErrorMsg("invalid search string"); return; } M_Strlwr(mn_searchstr); // run through every menu in the search list... while((curMenu = mn_search_menus[i++])) { menu_t *curPage = curMenu; // run through every page of the menu while(curPage) { int j = 0; menuitem_t *item; // run through items while((item = &(curPage->menuitems[j++]))) { char *desc; if(item->type == it_end) break; if(!item->description) continue; // keep seeking until we pass the last item found if(item == lastMatch) { pastLast = true; continue; } if(!pastLast) continue; desc = M_Strlwr(strdup(item->description)); // found a match if(strstr(desc, mn_searchstr)) { // go to it lastMatch = item; MN_StartMenu(curPage); MN_ErrorMsg("found: %s", desc); if(!is_a_gap(item)) curPage->selected = j - 1; free(desc); return; } free(desc); } curPage = curPage->nextpage; } } if(lastMatch) // if doing a valid search, reset it now { lastMatch = NULL; MN_ErrorMsg("reached end of search"); } else MN_ErrorMsg("no match found for '%s'", mn_searchstr); }

Old Post 03-16-06 01:52 #
Quasar is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy Report to mod || IP || Edit/Delete || Quote
SoM
azerty YAY!


Posts: 193
Registered: 03-02



Quasar said:
I pasted the code just to make this post longer and to piss off people who hate code ^_^



haha! Nice :)

Old Post 03-16-06 04:25 #
SoM is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy Report to mod || IP || Edit/Delete || Quote
Anders
No one knows I'm schepe


Posts: 419
Registered: 03-02


you know you need to redesign your menus when:

1) You need a search function to find stuff in them.

Old Post 03-16-06 22:04 #
Anders is offline Profile || Blog || PM || Homepage || Search || Add Buddy Report to mod || IP || Edit/Delete || Quote
JoelMurdoch
Should know better by now


Posts: 656
Registered: 02-02


Well that was a useful contribution.

Have you actually seen the menus anders?

Old Post 03-19-06 00:12 #
JoelMurdoch is offline Profile || Blog || PM || Email || Search || Add Buddy Report to mod || IP || Edit/Delete || Quote
Quasar
Moderator


Posts: 2202
Registered: 08-00


The menus have already BEEN redesigned; in fact they are now 99.9% finished. The search function is there for two reasons:

1) I NEVER want to hear "I can't find so-and-so in the menus" again in my life, no matter what.

2) To ease the transition now that many things have been moved around to more logical places.

Old Post 03-20-06 20:26 #
Quasar is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy Report to mod || IP || Edit/Delete || Quote
All times are GMT. The time now is 08:48. Post New Thread    Post A Reply
 
Doomworld Forums : Powered by vBulletin version 2.2.5 Doomworld Forums > Special Interest > Eternity > Menu Search Feature

Show Printable Version | Email this Page | Subscribe to this Thread

 

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are OFF
[IMG] code is ON
 

< Contact Us - Doomworld >

Powered by: vBulletin Version 2.2.5
Copyright ©2000, 2001, Jelsoft Enterprises Limited.

Forums Directory