Problem symptoms:
When I olc mobprogs in game, they work fine. but, once even one mob is
linked to a mobprog, the mud will not boot, giving me the  bug message
"fix_mobprogs, vnum not found".  when I delete the call to the mobprog in
the mob section of the .are file, the mud starts fine...but  the mobprog is
not loaded from the #mobprog section.  meaning, I basically have to re-write
all mobprogs every boot.

What I have done so far:

Looking at the code in fix_mobprogs, I traced the problem(using bug
statements) into a call of the get_prog_index() function.

Here is what I can see......


PROG_CODE *get_prog_index( int vnum, int type )
{
    PROG_CODE *prg;
        int debug;
bug( "inside get_prog_index.right before the switch statement using type =
%d", type );
bug( "And the other paramater that should have been passed was vnum = %d",
vnum );
/*The above two bugs print fine, the two parameters are being passed
correctly*/
    switch ( type )
    {
        case PRG_MPROG:
            prg = mprog_list;
            break;
        case PRG_OPROG:
            prg = oprog_list;
            break;
        case PRG_RPROG:
            prg = rprog_list;
            break;
        default:
            return NULL;
    }
bug( "if this shows, the type switch statement worked.", 0 );
/*This bug prints fine, type is set to "0" which is equivalent to PRG_MPROG:
 *thus the code of "prg = mprog_list;" should have been executed
 */
debug = prg->vnum;
/*Here the boot craps out. complete stop. access violation.
 *In debugging, it shows that there are NO values set in prg
 *leading me to think that the line "prg = mprog_list" didn't
 *work, leading to all of my problems.
 */
bug( "prg should have been set to mprog_list prg->vnum is %d.", debug );
    for( ; prg; prg = prg->next )
    {
        if ( prg->vnum == vnum )
            return( prg );
    }
    return NULL;
/*with prg entering that for loop as NULL, the if check is false, thus
 *this function returns null, giving me the Fix_mobrpog error I have
 *been getting.
 */
}


All is fine and dandy up to this point, I'm tracking down and narrowing in
on the problem all by myself.

The problem that leads me to email you guru's for help, however, is when I
try to track down mprog_list from the statement "prg = mprog_list".

I ask myself, "if prg isn't getting set with any values, maybe the problem
is that mprog_list doesn't have any values to put into prg"

Well, I search for all instances of mprog_list...
I find it declared in db.c:
  PROG_CODE *           mprog_list;

I find it declared in merc.h:
  extern   PROG_CODE         *     mprog_list;

I find it used in the mpedit_create() function:
  pMcode                        = new_mpcode();
  pMcode->vnum          = value;
  pMcode->next          = mprog_list;
  mprog_list            = pMcode;

And, I find it used in the mpedit_list()function:
  for (mprg = mprog_list; mprg !=NULL; mprg = mprg->next)


The only place it is set with a value that I can find is in the
mpedit_create function...which is not called during the boot process (that I
can tell).

So, my questions to you all basically boil down to three questions.
1) Am I right that my problem stems from prg not getting set with any values
because nowhere is mprog_list getting set with any values?

2) If I am right, I am at a loss as to where that SHOULD be getting set.

3) If I am wrong, what else should I be looking for?



Reply via email to