[Long][Code] !PURGE flag

From: StormeRider (silk@ICI.NET)
Date: 11/02/97


Ok, on my mud I decided that there are some things that I don't want to be
purgeable. For example, the bulletin boards, and objects that people can
sit on (not a good idea to free memory thats already freed when they stand
up if its been purged). I added the item flag and changed do_purge to the
below.

Any ideas why it still purges them if just "purge" or still "purge <item
flagged non-purge>"?

/* clean a room of all mobiles and objects */
ACMD(do_purge)
{
  struct char_data *vict, *next_v;
  struct obj_data *obj, *next_o;

  one_argument(argument, buf);

  if (*buf) {                   /* argument supplied. destroy single object
                                 * or char */
    if ((vict = get_char_room_vis(ch, buf))) {
      if (!IS_NPC(vict) && (GET_LEVEL(ch) <= GET_LEVEL(vict))) {
        send_to_char("Fuuuuuuuuu!\r\n", ch);
        return;
      }
      act("$n disintegrates $N.", FALSE, ch, 0, vict, TO_NOTVICT);

      if (!IS_NPC(vict)) {
        sprintf(buf, "(GC) %s has purged %s.", GET_NAME(ch), GET_NAME(vict));
        mudlog(buf, BRF, LVL_GOD, TRUE);
        if (vict->desc) {
          close_socket(vict->desc);
          vict->desc = NULL;
        }
      }
      extract_char(vict);
    } else
      if ((obj = get_obj_in_list_vis(ch, buf, world[ch->in_room].contents))
        && (!IS_OBJ_STAT(obj, ITEM_NOPURGE))) {
      act("$n destroys $p.", FALSE, ch, obj, 0, TO_ROOM);
      extract_obj(obj);
    } else {
      send_to_char("Nothing here by that name.\r\n", ch);
      return;
    }

    send_to_char(OK, ch);
  } else {                      /* no argument. clean out the room */
    act("$n gestures... You are surrounded by scorching flames!",
        FALSE, ch, 0, 0, TO_ROOM);
    send_to_room("The world seems a little cleaner.\r\n", ch->in_room);

    for (vict = world[ch->in_room].people; vict; vict = next_v) {
      next_v = vict->next_in_room;
      if (IS_NPC(vict))
        extract_char(vict);
    }

    for (obj = world[ch->in_room].contents; obj; obj = next_o) {
      next_o = obj->next_content;
      if (!IS_OBJ_STAT(obj, ITEM_NOPURGE))
        extract_obj(obj);
    }
  }
}


        .--.        .-----------       StormeRider
       // / \  __  /    ------        winds@ici.net
      ///////\(  `-,   ----
     //// /// '~ (    ---         CircleMUD 3.0bpl11
    // /  // :    ; ---              cmoo.com:4004
   /     /  /)   / --
           //..\\       http://members.tripod.com/~WindsOfStorm
           UU   UU
           '//||\\`


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



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