Re: Damage messages and types (fight.c)

From: Del Minturn (
Date: 03/26/99

So far everyone has thought that I can not distinguish which statement
is within each "if". I do.

In plain text:
1. If the attack is by someting other than a weapon send the skill
2a. if victim is dead or damage is 0 (miss)
      and if there is no skill message send damage message
2b.  send damage message

now tell me why someone would want an if statement to:
 a. send damage message
 b. send damage message

Why not just send damage message and get rid of the if???

My guess is, there use to be another part to the section, which got
removed, leaving it the way it is.

Eric Helvey wrote:
> 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);
>   }
> }

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  |

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