Re: Damage messages and types (fight.c)

From: Eric Helvey (helver@alliances.org)
Date: 03/26/99


Classic parser "dangling else" problem.  You're just having difficulty
parsing the code.

if (!IS_WEAPON(attacktype))
  skill_message(dam, ch, victim, attacktype);
else {
  if (GET_POS(victim) == POS_DEAD || dam == 0) {
    if (!skill_message(dam, ch, victim, attacktype)) { //<==== add this {
      dam_message(dam, ch, victim, attacktype);
    } //<=== and this }  and it should all become clear.
  } else {
    dam_message(dam, ch, victim, attacktype);
  }
}

On Fri, 26 Mar 1999, Del wrote:

> George Greer wrote:
> >
> > On Fri, 26 Mar 1999, Del wrote:
> >
> > >Why have a check if !skill_message and else statement to do the same thing?
> >
> >   if (!IS_WEAPON(attacktype))
> >     skill_message(dam, ch, victim, attacktype);
> >   else {
> >     if (GET_POS(victim) == POS_DEAD || dam == 0) {
> >       if (!skill_message(dam, ch, victim, attacktype))
> >         dam_message(dam, ch, victim, attacktype);
> >     } else {
> >       dam_message(dam, ch, victim, attacktype);
> >     }
> >   }


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