[CODE][BUGGY CODE :P][OBJPURGE ------

From: Ronny Iversen (ronnyi@ifi.uio.no)
Date: 01/13/99


Wrote a function to extract all objects of certain virtual number,
only problem is it goes loco whenever the objects r extracted, if I
comment out
the extract(i) it works fine, can anybody tell me why? :)

Nocturnal

ACMD(do_objpurge) {
  struct obj_data *i;
  int number, r_num;
  bool found = FALSE;

  one_argument(argument, buf);

  if(*buf) {
    if (!isdigit(*buf)) {
      send_to_char("Usage: objpurge [vnum]\r\n", ch);
      return;
    }

    if ( (number = atoi(buf)) < 0) {
      send_to_char("A NEGATIVE number??\r\n", ch);
      return;
    }

    if ( (r_num = real_object(number)) < 0) {
      send_to_char("There is no mob with that number.\r\n", ch);
      return;
    }

    for (i = object_list; i; i = i->next) {
      fprintf(stderr, "%s\n", i->name);
      if (GET_OBJ_RNUM(i) == r_num) { /* this is where it crashes :( */
 if (i->carried_by) {
   act("$p burns into fine ashes and slips through your fingers.",
FALSE, i->carried_by, i, 0, TO_CHAR);
 } else if ((i->in_room != NOWHERE) && (world[i->in_room]->people)) {
   act("$p is burned into fine ashes and slips through $n's fingers.",
TRUE, world[i->in_room]->people, i, 0, TO_ROOM);
   act("$p is burned into fine ashes and slips through $n'ss fingers.",
TRUE, world[i->in_room]->people, i, 0, TO_CHAR);
 } else if (i->worn_by) {
   act("$p burns into fine ashes is taken by the breeze.", FALSE,
i->worn_by, i, 0, TO_CHAR);
   act("$n's $p burns into fine ashes is taken by the breeze.", FALSE,
i->worn_by, i, 0, TO_ROOM);
 }
 extract_obj(i);  /* if I comment out this then it works fine */
 found = TRUE;
      }
    }
    if (found) {
      sprintf(buf, "%s objpurges all objects with vnum %d",
GET_NAME(ch), number);
      mudlog(buf, BRF, LVL_GRGOD, TRUE);
    }
  }
}


--
--------------- Codito, ergo sum - "I code, therefore I am" --------------------

http://birk113.studby.uio.no/~ronnyi                           ronnyi@ifi.uio.no

---------------- In a world without fences, who need gates? --------------------


     +------------------------------------------------------------+
     | 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