Couple of quick questions:

>Ack. I added a new sh_int to the interp.c table called term...
So your commands look like this now, correct?

{"north", do_north, POS_STANDING, 0, LOG_NEVER, 0, 0},

(extra 0 on the end)

Did you go into interp.h and adjust the structure cmd_type?

I.E.
struct cmd_type
{
    char * const name;
    DO_FUN *  do_fun;
    sh_int  position;
    sh_int  level;
    sh_int  log;
    sh_int              show;
};

becomes:

struct cmd_type
{
    char * const name;
    DO_FUN *  do_fun;
    sh_int  position;
    sh_int  level;
    sh_int  log;
    sh_int              show;
    sh_int              term;
};

If you did, I don't see why it wouldn't work.  Hmm.

Here's a suggestion on how I'd change the command looker-uper:

Old:
    /*
     * Look for command in command table.
     */
    found = FALSE;
    trust = get_trust (ch);
    for (cmd = 0; cmd_table[cmd].name[0] != '\0'; cmd++)
    {
        if (command[0] == cmd_table[cmd].name[0]
            && !str_prefix (command, cmd_table[cmd].name)
            && cmd_table[cmd].level <= trust)
        {
            found = TRUE;
            break;
        }
    }

This would become:

    /*
     * Look for command in command table.
     */
    found = FALSE;
    bool termcmd = FALSE;
    trust = get_trust (ch);
    for (cmd = 0; cmd_table[cmd].name[0] != '\0'; cmd++)
    {
        if (command[0] == cmd_table[cmd].name[0]
            && !str_prefix (command, cmd_table[cmd].name)
            && cmd_table[cmd].level <= trust)
        {
            cmd_table[cmd].term == 1? (found = TRUE, termcmd = TRUE) : found
= TRUE;
            break;
        }
    }

I _believe_ that would work, if it didn't, then try changing the
cmd_table[cmd].term
line to this:

cmd_table[cmd].term == 1? found, termcmd = TRUE : found = TRUE;

That _should_ work, too, I'd think.  Umm, not entirely certain, sorry.. if
it's wrong, I'm sure Edwin will correct me *grin* :)

Best of luck,

Jeremy Hill


Reply via email to