SEMI NEWBIE: Code question, crashing. [Part 2] :(

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


Hi all,
       Below is all the code I have added to have battle information 
included in the players prompt. It works well, except for a few points.

(1) I think I have included all for the new PRF_BAT flag but it doesn't 
recognise it is set in comm.c, consequently the /* 's in the make_prompt 
function. What have I missed? **--** I still cant get this working. :(

(2) The prompt works fine displaying all that it's meant to up until the 
mob I am fighting gets to incapacitated. At which point it seg faults. 
Any ideas as to why? **--** I've now got this working, thanks for the help 
Graham. :)  If anyone is interested I included the changes needed below 
if they'd like to include it in their mud. :)

--* comm.c *--

char *get_cond(int current, int total)
{
  int percent;

  if (total < 1)
    total = 1;
  
  percent = (100 * current) / total;

  if (percent >= 100)
    return ("excellent");
  else if (percent >= 90)
    return ("few scratches");
  else if (percent >= 80)
    return ("some wounds");
  else if (percent >= 70)
    return ("few wounds");
  else if (percent >= 60)
    return ("pretty hurt");
  else if (percent >= 50)
    return ("deep cuts");
  else if (percent >= 40)
    return ("nasty wounds");
  else if (percent >= 30)
    return ("badly injured");
  else if (percent >= 20)
    return ("awful");
  else if (percent >= 10)
    return ("life threating");
  else if (percent >= 1)
    return ("near death");
  else
    return ("unconscious");
}



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