Re: [Circle] [Code] falling_char

From: Jorge Miguel Guilherme (jmg@students.si.fct.unl.pt)
Date: 11/15/96


On Fri, 15 Nov 1996, Chris Grantham wrote:

> I dunno.. mebe it's me.. but I'd put a case 0 in there just incase
> something gets messed and this is called when dam == 0. (They'd die ;)    )
> > switch(rooms_fallen) {
> case 0: dam = 0;
> >   case 1: dam = GET_MAX_HIT(ch) * .2;
> >   case 2: dam = GET_MAX_HIT(ch) * .3;
> >   case 3: dam = GET_MAX_HIT(ch) * .66;
> >   case 4: dam = GET_MAX_HIT(ch) * .9;
> >   default: dam = GET_MAX_HIT(ch);  /* ouch */
> > }
 I didn't see the original post, but if you daon't put a break in the end
of each case you'll have a "faulthrou" (sp?) and if rooms_fallen=0 every
GET_MAX_HIT(ch) *... will be executed. And if rooms_fallen=1 all will be
executed except for the fist one (case 0).

 Change it to something like this:
 switch(rooms_fallen) {
   case 0: dam = 0;break;
   case 1: dam = GET_MAX_HIT(ch) * .2;break;
   case 2: dam = GET_MAX_HIT(ch) * .3;break;
   case 3: dam = GET_MAX_HIT(ch) * .66;break;
   case 4: dam = GET_MAX_HIT(ch) * .9;break;
   default: dam = GET_MAX_HIT(ch);  /* ouch */
}


      Jorge Guilherme

+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



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