Another practice header

Posted by Zeno on Sun 13 Aug 2006 02:09 AM — 1 posts, 4,786 views.

USA #0
In the practice list, there are multiple headers. One for spells, skills, tongues, etc. I want to hardcode another one in much like the Spells one is. Here's the code:

if ( argument[0] == '\0' )
    {
        int     col;
        sh_int  lasttype, cnt;

        col = cnt = 0;  lasttype = SKILL_SPELL;
        set_pager_color( AT_MAGIC, ch );
        for ( sn = 0; sn < top_sn; sn++ )
        {
            if ( !skill_table[sn]->name )
                break;

            if ( !strcmp(skill_table[sn]->name, "reserved") && ch->pcdata->learned[sn] > 0 )
                bug( "do_prac: %s reserved skill is %d%%.", ch->name, ch->pcdata->learned[sn] );

            if ( strcmp(skill_table[sn]->name, "reserved") == 0
            && ( IS_IMMORTAL(ch) || CAN_CAST(ch) ) )
            {
                if ( col % 3 != 0 )
                    send_to_pager( "\n\r", ch );
              set_pager_color( AT_MAGIC, ch );
              send_to_pager_color(
" &O----------------------------------[&CSpells&O]----------------------------------\n\r", ch);
                col = 0;
            }
            if ( skill_table[sn]->type != lasttype )
            {
                if ( !cnt )
                    send_to_pager( "                                   &z(none)\n\r", ch );
                else
                if ( col % 3 != 0 )
                    send_to_pager( "\n\r", ch );

                set_pager_color( AT_MAGIC, ch );
                pager_printf_color( ch,
" &O----------------------------------[&C%ss&O]----------------------------------\n\r",
                         skill_tname[skill_table[sn]->type]);
                col = cnt = 0;
            }
            lasttype = skill_table[sn]->type;


Further down, it displays the skill name and %. I need to change the code above to add another header, but I can't really follow the logic of it. I can't seem to get what I want. Under the new header, skills with a certain flag will should be shown.

I know how to solve this, but it's a poor solution. I'd just do another for loop inside this for loop. So I'll skip that, since I should be able to do this another way.

[EDIT] Hmm, it loads all spells first. Maybe this isn't possible because there's no way to display it how I want that order.

[EDIT 2] Ah well, I figured I'd just create an entire new skill type. Took me a bit to find some final things that had to be changed, but it seems to be working.