Help with code please

From: Del Minturn (caminturn@EARTHLINK.NET)
Date: 09/02/98


I have added in variables to mobs and players for number of attacks (no
problems there).
In perform_violence I can not figure out why I get this error:

fight.c: In function `perform_violence':
fight.c:927: warning: `ch' might be used uninitialized in this function

If I remove the two if statements, the code works fine. The rest of the
code references (ch) in several places so I don't quite understand what
is wrong.
Can someone point out what I am missing? or what I am doing wrong..


void perform_violence(void)
{
  struct char_data *ch;  /* this is line 927 */
  int attacks = 1, i;

  if (IS_NPC(ch) && (GET_MOB_ATTACKS(ch) > 0))
    attacks = GET_MOB_ATTACKS(ch);

  if (!IS_NPC(ch) && (GET_PC_ATTACKS(ch) > 0))
    attacks = GET_PC_ATTACKS(ch);

  for (ch = combat_list; ch; ch = next_combat_list) {
    next_combat_list = ch->next_fighting;

   for (i = 0; i < attacks; i++) {
    if (FIGHTING(ch) == NULL || ch->in_room != FIGHTING(ch)->in_room) {


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