Re: NEWBIE: Where is affect set?

From: Rasmus \ (raro94ab@hp4.econ.cbs.dk)
Date: 06/20/96


On Thu, 20 Jun 1996, Kevin Wing wrote:

> if (IS_AFFECTED(ch, AFF_RAGE))
>   hit(ch, FIGHTING(ch), TYPE_UNDEFINED);
> 
> Everytime this check is called, I get a seg fault, but my gdb won't 

Well, to get back to ONtopic posts, I thought I'd reply to this one :)
I'll bet your socks off that your problem is the common problem when we 
all play arround with the hit() routines. If you've added this piece of code
after the allready existing hit() call in perform_violence in fight.c you 
HAVE to make a check for the person fighting or not. Whats probably 
happening is that you call hit() then the mob FIGHTING(ch) is dead, and 
FIGHTING(ch) does not exist, and this will result in a segmentation fault.
Dunno if the seg. fault happens at the FIGHTING(ch) or in the hit() 
procedure, but my guess is in the hit() procedure.

Anyway. just do this little change:

if (IS_AFFECTED(ch, AFF_RAGE) && FIGHTING(ch)
  hit(ch, FIGHTING(ch), TYPE_UNDEFINED);

Now if you'e lucky I am right, and all yor segfaults will go away, if not 
I reccomend you to post a larger piece of your code arround the AFF_RAGE 
stuff.

Hope this helps and shows that I'm not just flaming people (*wink* Alex:)

Regards,
Con.

d.
--
     Rasmus Rønlev DOEK'94      WWW: http://www.econ.cbs.dk/people/raro94ab  
     Student instructor         MUD: exiled.mud.circlemud.org 5000
                                         199.199.16.100 5000
       Student, B.Sc in Computer Science and Business Administration. 



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