Greetings Rom List,

I would like to point a structure's do_fun to the do_fun's in the cmd_table, 
but I am having
some difficulty.

Here is my linked list structure:
struct menu_data
{
    MENU_DATA  * next;
    ...
    DO_FUN     * do_fun;
    ...
};

In the menu-creation interpreter function, here is where I attempt to point the 
menu's do_fun to
the cmd_table's do_fun:

for (cmd = 0; cmd_table[cmd].name[0] != '\0'; cmd++)
    {
        if (!str_cmp(cmd_table[cmd].name, word))
            menu->do_fun = cmd_table[cmd].do_fun;
    }

However, this apparently does not work, according to my checking program:
Code:
    if (ch->pcdata->menu)
    {
        sprintf(buf, "Name: %s  Address of function: %p  ",
            ch->pcdata->menu->name, ch->pcdata->menu->do_fun);
        send_to_char(buf, ch);
    ...


Result:
Name: do_list  Address of function: (nil)

===

I have no problems assigning menus to players, but the do_fun is troublesome.  
What am I doing
wrong?

-- Jeremy

P.S.
As a sidenote, if it may help, previously to this I pointed a menu's do_fun 
directly to a
function without using the cmd_table:
"menu->do_fun = &do_buy;" without any problems.


Reply via email to