Code Problems

From: Albert Brauneis (Dajawu36@aol.com)
Date: 04/23/99


Hello,

I have come across two errors that are crashing my MUD completly, I managed
to debug these errors. The first one is when kill someone it calls
hitprcnt_mtrigger, that is with DG_SCRIPTS. For some reason it crashes in
that function. Below is the function and the line my debugger is point at.

void hitprcnt_mtrigger(char_data *ch)
{
  trig_data *t;
  char buf[MAX_INPUT_LENGTH];

  if (!SCRIPT_CHECK(ch, MTRIG_HITPRCNT) || !FIGHTING(ch) ||
      AFF_FLAGGED(ch, AFF_CHARM))      <<<<<THIS IS THE LINE RIGHT HERE
    return;

  for (t = TRIGGERS(SCRIPT(ch)); t; t = t->next) {
    if (TRIGGER_CHECK(t, MTRIG_HITPRCNT) && GET_MAX_HIT(ch) &&
        (((GET_HIT(ch) * 100) / GET_MAX_HIT(ch)) <= GET_TRIG_NARG(t))) {

      ADD_UID_VAR(buf, t, FIGHTING(ch), "actor", 0)
      script_driver(ch, t, MOB_TRIGGER, TRIG_NEW);
      break;
    }
  }
}

The other error is weird, it happens in my sacrifice procedure but only when
you try to sacrifice all. It calls ACT to tell the room you are sacrificing
and crashes in the ACT procedure, that is the only time the ACT procedure has
trouble. Below is the sacrice code:

ACMD(do_sac)
{
        struct obj_data *obj, *next_o;

        one_argument(argument, arg);

        if (!*arg)
        {
                send_to_char("Sacrifice What?\n\r",ch);
                return;
        }

        if(!str_cmp("all",arg))
        {
                for (obj = world[ch->in_room].contents; obj; obj = next_o)
                {
                        if (!CAN_WEAR(obj,ITEM_WEAR_TAKE))
                        {
                                send_to_char("You can't sacrifice that!",ch);
                                next_o = obj->next_content;
                                continue;
                        }

                        next_o = obj->next_content;
                        extract_obj(obj);
                        act("$n sacrifices $p.", FALSE, ch, obj, 0, TO_ROOM);
                        act("You sacrifice $p to Albert.\r\nYou have been
rewarded by your deity.",
                                FALSE, ch, obj, 0, TO_CHAR);
                        GET_GOLD(ch) = GET_GOLD(ch) + 10;
                }
                return;
        }

        if (!(obj = get_obj_in_list_vis(ch, arg,
world[ch->in_room].contents)))
        {
                send_to_char("That isn't here!\n\r",ch);
                return;
        }

        if (!CAN_WEAR(obj, ITEM_WEAR_TAKE))
        {
                send_to_char("You can't sacrifice that!\r\n",ch);
                return;
        }

    act("$n sacrifices $p.", FALSE, ch, obj, 0, TO_ROOM);
    act("You sacrifice $p to Albert.\r\nYou have been rewarded by your
deity.",
                FALSE, ch, obj, 0, TO_CHAR);
        extract_obj(obj);
        GET_GOLD(ch) = GET_GOLD(ch) + 10;
}

And when you call sacrice all this is were the debugger points in the ACT
procedure:

case 'o':
CHECK_NULL(obj, OBJN(obj, to));
break;
case 'O':
CHECK_NULL(vict_obj, OBJN((const struct obj_data *) vict_obj, to));
dg_target = (struct obj_data *) vict_obj;
break;
case 'p':
CHECK_NULL(obj, OBJS(obj, to)); <<<<THIS IS THE LINE
break;
case 'P':
CHECK_NULL(vict_obj, OBJS((const struct obj_data *) vict_obj, to));
dg_target = (struct obj_data *) vict_obj;
break;
case 'a':
CHECK_NULL(obj, SANA(obj));
break;

If anyone can give me any help what-so-ever it would be very very helpfull.

Thanks,
Albert


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST