[Code] multiattacks crash

From: Rob Hofstetter (rch@mci2000.com)
Date: 09/08/96


-- [ From: Rob Hofstetter * EMC.Ver #3.2 ] --

I've implemented the same kind of multiattack that annick was trying, and I too
crash after a few rounds. I however, didn't change anything with the messaging.
The crashes are fairly random, and even happened to the imp. Since I was getting
a protection violation I tried increasing stack and heapsizes to 16meg and 64meg
respectively. It didn't have any effect on the situation. Other than these
changes to perform_violence, I didn't change a whole lot. Added the skills of
course. Anybody have any ideas what's goin on?

Rob
rch@mci2000.com

/* control the fights going on.  Called every 2 seconds from comm.c. */
void perform_violence(void)
{
  struct char_data *ch;
  extern struct index_data *mob_index;
  int cond, skill_level, spellnum;
  for (ch = combat_list; ch; ch = next_combat_list)
  {
     next_combat_list = ch->next_fighting;

     if (FIGHTING(ch) == NULL || ch->in_room != FIGHTING(ch)->in_room)
     {
       stop_fighting(ch);
       continue;
     }

     if (IS_NPC(ch))
     {
         if (GET_MOB_WAIT(ch) > 0)
         {
             GET_MOB_WAIT(ch) -= PULSE_VIOLENCE;
         }
         else if (GET_POS(ch) < POS_FIGHTING)
         {
             GET_POS(ch) = POS_FIGHTING;
             act("$n scrambles to $s feet!", TRUE, ch, 0, 0, TO_ROOM);
         }
         GET_MOB_WAIT(ch) = 0;
         /* -rch 11/10/95 */
         cond = (float)GET_HIT(ch)/(float)GET_MAX_HIT(ch) * 100.00;
         if (cond > 99)
             act("$n is in excellent condition.",FALSE, ch, 0, 0, TO_ROOM);
         else if (cond > 89)
             act("$n has a few scratches.",FALSE, ch, 0, 0, TO_ROOM);
         else if (cond > 79)
             act("$n has a welt on the forehead.",FALSE, ch, 0, 0, TO_ROOM);
         else if (cond > 69)
             act("$n is bleeding a little.",FALSE, ch, 0, 0, TO_ROOM);
         else if (cond > 59)
             act("$n is bleeding all over.",FALSE, ch, 0, 0, TO_ROOM);
         else if (cond > 49)
             act("$n is hurting.",FALSE, ch, 0, 0, TO_ROOM);
         else if (cond > 39)
             act("$n looks pretty awfull.",FALSE, ch, 0, 0, TO_ROOM);
         else if (cond > 29)
             act("$n is badly wounded.",FALSE, ch, 0, 0, TO_ROOM);
         else if (cond > 19)
             act("$n is seriously wounded.",FALSE, ch, 0, 0, TO_ROOM);
         else if (cond > 9)
             act("$n is vomitting blood.",FALSE, ch, 0, 0, TO_ROOM);
         else if (cond >= 0)
             act("$n pales visibly as death nears.",FALSE, ch, 0, 0, TO_ROOM);
         else if (cond < 0)
             act("something is wrong with the damage display
routine.",FALSE,ch,0,0, TO_ROOM);
    }

    if (GET_POS(ch) < POS_FIGHTING)
    {
        send_to_char("You can't fight while sitting!!\r\n", ch);
        continue;
    }

    hit(ch, FIGHTING(ch), TYPE_UNDEFINED);
    spellnum = 142;
    if (GET_LEVEL(ch) >= SINFO.min_level[(int) GET_CLASS(ch)])
    {
      skill_level = GET_SKILL(ch, spellnum); /* 9/7/96 rch */
      if ((number (0,101)) <= skill_level)
        hit(ch, FIGHTING(ch), TYPE_UNDEFINED);
      spellnum = 143;
      if (GET_LEVEL(ch) >= SINFO.min_level[(int) GET_CLASS(ch)])
      {
        skill_level = GET_SKILL(ch, spellnum);
        if ((number (0,101)) <= skill_level)
          hit(ch, FIGHTING(ch), TYPE_UNDEFINED);
      }
    }

    if (MOB_FLAGGED(ch, MOB_SPEC) && mob_index[GET_MOB_RNUM(ch)].func != NULL)
       (mob_index[GET_MOB_RNUM(ch)].func) (ch, ch, 0, "");
  }
}


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



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