oh and forgot, make sure you free that temp_help_array forgot to do that in that tid bit I sent you.
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Dale Kingston Sent: Thursday, August 12, 2004 10:28 AM To: Valnir Cc: [email protected] Subject: RE: Sorting. Whats there to this rewriting the entire loading process? Takes 5 seconds, if your not willing to put out that much effort why are you trying to sort in the first place? It's simple: int compare(const void *a, const void *b) { struct help_data *hp1, *hp2; sk1 = (struct help_data *)a; sk2 = (struct help_data *)b; if (hp1->name == NULL ) return 1; else if (hp2->name == NULL ) return -1; if ( !str_cmp( hp1->name, "reserved" ) ) return -1; else if ( !str_cmp( hp2->name, "reserved" ) ) return 1; return strcmp(hp1->name, hp2->name); // not 100% sure on the order of those } code for loading: for (num_helps = 1, pHelp = help_list; pHelp != NULL; num_helps++, pHelp = pHelp->next); Temp_help_array = malloc( sizeof(struct help_data) * (num_helps + 1) ); for (count = 0, pHelp = help_list; pHelp != NULL; count++, pHelp = pHelp->next) temp_help_array[count] = pHelp; temp_help_array[num_help+1] = NULL; qsort( temp_help_array, num_helps, sizeof(struct help_data), compare ); help_list = temp_help_array[0]; for (count = 1, pHelp = help_list; count < num_helps+1; count++) { pHelp->next = temp_help_array[count]; } Now havn't tested any of this but in theiory it should work... Thats not rewriting your loading, it's adding a small extra to it. Another suggestion that I did to save me all this pain in the mud, was converted my helpfiles to mysql, and the query line just requests it in order. But that takes some rewriting :P -----Original Message----- From: Valnir [mailto:[EMAIL PROTECTED] Sent: Thursday, August 12, 2004 8:36 AM To: Dale Kingston Subject: Re: Sorting. Nope, cause I really didn't want to re-write the entire load process.. lazy I guess. If anyone has any more input, it would be great too. Although I may have to resort to this. :( - Valnir ----- Original Message ----- From: "Dale Kingston" <[EMAIL PROTECTED]> To: "Valnir" <[EMAIL PROTECTED]>; <[email protected]> Sent: Thursday, August 12, 2004 10:27 AM Subject: Re: Sorting. > I belive that cause helps are contained in a link list that qsort and that > doesn't work as well.. > > Have you tried loading your helps into a temporary array running it threw > the sorter and then remaking the list after it's sorted the area? > > > ----- Original Message ----- > From: "Valnir" <[EMAIL PROTECTED]> > To: <[email protected]> > Sent: Thursday, August 12, 2004 8:05 AM > Subject: Sorting. > > > > Ok, a while back I was asking how to sort my skills. Well, I figured that > > all out and it's working great. I got a new sorting issue though. I want > > to > > sort my HELPS. This is a whole different arena. Tried using the same > > thought > > process.. BOOM. > > > > My helps are in the 'struct help_data' and 'struct help_data HELP_DATA' > > format. Any help would be great. (and of course they load on boot into the > > 'help_first' etc format.) > > > > - Valnir > > > > > > -- > > ROM mailing list > > [email protected] > > http://www.rom.org/cgi-bin/mailman/listinfo/rom > > -- ROM mailing list [email protected] http://www.rom.org/cgi-bin/mailman/listinfo/rom

