Re: [CODE] Question about LordKaT's dual-wield patch.

From: Adam Scriven (scriven@lore.com)
Date: 10/01/00


On Sun, Oct 01, 2000 at 05:25:42PM +0100, Chris Gilbert wrote:
> On Sun, 01 Oct 2000, you wrote:
>
> note that this is unrelated to the question, but just something I spotted
>
> > He has the following code at the end of the hit function, to call the
> > double_hit stuff:
> >
> >         else {
> >                 damage(ch, victim, dam, w_type);
> >                 if (GET_EQ(ch, WEAR_DWIELD) && GET_HIT(victim) > 0)
> >                         double_hit(ch, FIGHTING(ch), TYPE_UNDEFINED);
> >         }
> >
>
> It's worth noting that if you're using bpl 14 (or higher) you want a check on
> the return value of damage.  If you don't there's the possibility that victim
> may no long be valid, check fight.c for the return codes.  If you don't you
> may crash when you dereference victim...

Actually, I checked through the code, and this isn't checked very much.
BUT, it did help me solve a very annoying ranged-attack button that was
crashing on this EXACT scenario!
Thanks Chris!

Adam


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 04/10/01 PDT