[CODE] spell wear off msg.

From: Bill Pascoe (wspascoe@bellsouth.net)
Date: 01/26/03


I've recently added the room affection code and now I seem to be having a
prob with my wear off messages When I cast a spell the affect gets set like
it supposed to. but about a min later I get the wear off msg. When I stat
the character however the affect is still set for the duration that its
supposed to be. It just seems to be getting the message early. Here is my
affect update code. The only times I've altered it is when I added entangle
and the room affection code. If someone can tell me what up or maybe if
they have had that prob. I honestly dont remember if it was like that
before I added the room code.





/* affect_update: called from comm.c (causes spells to wear off) */
void affect_update(void)
{
  struct affected_type *af, *next;
  struct char_data *i;
  struct raff_node *raff, *next_raff, *temp;
  extern struct raff_node *raff_list;


  for (i = character_list; i; i = i->next)
        for (af = i->affected; af; af = next) {
          next = af->next;
          if (af->duration >= 1)
        af->duration--;
          else if (af->duration == -1)    /* No action */
        af->duration = -1;    /* GODs only! unlimited */
          else {
        if ((af->type > 0) && (af->type <= MAX_SPELLS))
          if (!af->next || (af->next->type != af->type) ||
                  (af->next->duration > 0))
                if (spell_info[af->type].wear_off_msg) {
                  send_to_char(spell_info[af->type].wear_off_msg, i);
                  send_to_char("\r\n", i);
                if (af->bitvector == AFF_TANGLED)
                  act ("$n is free of the vines that bind,",TRUE,i,0,0,TO_ROOM);
                }
        affect_remove(i, af);
          }
        }
   /* update the room affections */
    for (raff = raff_list; raff; raff = next_raff) {
       next_raff = raff->next;
       raff->timer--;
       if (raff->timer <= 0) {
      /* this room affection has expired */
         send_to_room(spell_info[raff->spell].wear_off_msg, raff->room);
         send_to_room("\r\n", raff->room);
       /* remove the affection */
       REMOVE_BIT(world[(int)raff->room].room_affections, raff->affection);
       REMOVE_FROM_LIST(raff, raff_list, next)
       free(raff);
       }
    }
}

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/26/03 PDT