It's not a math problem but a pointer problem (segmentation fault gives it
away).

As line 191 is the first time you de-reference victim, I'd say that's your
problem, the victim pointer passed to saves_spell is invalid.

You'll need to step back up the stack to find where saves_spell is being
called from when the MUD crashes.


Ian.

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Jason
> Gauthier
> Sent: 06 December 2001 21:41
> To: '[email protected]'
> Subject: Math problem?
>
>
> Anyone want to take a shot in the dark as to why this crashed my mud?
>
> Program terminated with signal 11, Segmentation fault.
> #0  0x80d5440 in saves_spell (level=200, victim=0xbc94450, dam_type=18)
>     at magic.c:191
> 191         save = ( (victim->level/2) - (level/2)) * 5 -
> victim->saving_throw * 1.25;
> (gdb) list saves_spell
> 186      */
> 187     bool saves_spell( int level, CHAR_DATA *victim, int dam_type )
> 188     {
> 189         int save, num;
> 190         CLASS *cl;
> 191         save = ( (victim->level/2) - (level/2)) * 5 -
> victim->saving_throw * 1.25;
> 192
> 193         if (IS_AFFECTED(victim,AFF_BERSERK))
> 194             save += victim->level/2;
> 195
> (gdb) print  ( (victim->level/2) - (level/2)) * 5 - victim->saving_throw *
> 1.25
> $1 = -453.75
>
>
>
>
> --
> ROM mailing list
> [email protected]
> http://www.rom.org/cgi-bin/mailman/listinfo/rom


Reply via email to