Re: [NEWBIE]Mud crashes whenever a char starts a fight 98 08:28:34 am

From: Andrew Helm (ashe@IGLOU.COM)
Date: 09/05/98


On Sat, 5 Sep 1998, Bob Mills wrote:
>Last night I finally got OLC+ patched in, and everything compiled fine.
>Only prob is that now whenever a mob attacks, it crashes the mud.  I ran
>the debugger and it showed me where it was crashing, but I am not the
>best at C yet so I am a little clueless.  This happened with just stock
>circle and the OLC patched in.

Don't worry; it's a hard bug for a newbie to track down.
However, this problem has been brought up on the mailing
list. I'll repost the fix here, but you may want to try
searching the archives in the future. :)

The archives can be found at:
http://post.queensu.ca/~listserv/wwwarch/circle.html

[snip]
>Here is what debugger showed me
>
>void hitprcnt_mtrigger(char_data *ch)
[snip]
>

In fight.c, in the hit() function make the following changes:

void hit(struct char_data * ch, struct char_data * victim, int type){
  struct obj_data *wielded = GET_EQ(ch, WEAR_WIELD);
- int w_type, victim_ac, calc_thaco, dam, diceroll;
+ int w_type, victim_ac, calc_thaco, dam = 0, diceroll;

[...]

    if (type == SKILL_BACKSTAB) {
      dam *= backstab_mult(GET_LEVEL(ch));
-     damage(ch, victim, dam, SKILL_BACKSTAB);
+     dam = damage(ch, victim, dam, SKILL_BACKSTAB);
    } else
-     damage(ch, victim, dam, w_type);
+     dam = damage(ch, victim, dam, w_type);
  }

  /* check if the victim has a hitprcnt trigger */
+ if (dam >= 0)
    hitprcnt_mtrigger(victim);
}


     +------------------------------------------------------------+
     | 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/15/00 PST