NEWBIE: [CODE] Help, why am I getting this warning?

From: Fionn Colvin (fcolvin@metz.une.edu.au)
Date: 05/28/96


Hi all,
       I wrote the following code for loss of exp when you die. It 
complies with the following warning. What have I done wrong to generate it?

make  ../bin/circle
make[1]: Entering directory `/a/turing/disks/turing/12g/pg/fcolvin/Files/Muds/The_Dales/src'
gcc -c -g -O -Wall -fno-strict-prototypes  fight.c
fight.c: In function `die':
fight.c:346: warning: array subscript has type `char'
gcc -o ../bin/circle  comm.o color.o act.comm.o act.informative.o act.movement.o act.item.o act.offensive.o act.other.o act.social.o act.wizard.o ban.o boards.o castle.o class.o config.o constants.o db.o fight.o graph.o handler.o house.o interpreter.o lim
its.o magic.o mail.o mobact.o mobcmd.o mobprog.o modify.o objsave.o olc.o shop.o spec_assign.o spec_procs.o spell_parser.o spells.o utils.o weather.o -lmalloc 
make[1]: Leaving directory `/a/turing/disks/turing/12g/pg/fcolvin/Files/Muds/The_Dales/src'


void die(struct char_data * ch, struct char_data *killer)
{
  int exploss;
  int maxloss;
  int clvl;
  int nlvl;

  exploss = (GET_EXP(killer));
  clvl = (titles[(int) GET_CLASS(ch)][GET_LEVEL(ch)].exp);      <-- Line 346
  nlvl = (titles[(int) GET_CLASS(ch)][GET_LEVEL(ch) + 1].exp);
  maxloss = (nlvl - clvl);
  maxloss = (maxloss / 2);
  exploss = (MIN(exploss, maxloss));

  gain_exp(ch, exploss);
  if (!IS_NPC(ch))
    REMOVE_BIT(PLR_FLAGS(ch), PLR_KILLER | PLR_THIEF);
  raw_kill(ch, killer);
}

Thanks for the help.

Fionn



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