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

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


Hey all.

It's been a bit of a marathon coding weekend here.
Got a bunch of cool stuff added to the mud, the biggest of which was
LordKaT's dual-wield skill and stuff.

It works just fine, but I noticed that no matter what weapon you were
wielding and dual-wielding, the messages for both were always from the primary
weapon's attributes (slash, pound, whatever).  This made me think that maybe
the rest of the stuff is too.

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);
        }

So that if you wiff with the first one, you wiff with the second automatically.

This is the only place that double_hit's called.

Ok, so in double_hit (which as he said is bascially a re-doing of hit),
it starts off like this:

void double_hit(struct char_data * ch, struct char_data * victim, int type)
{
        struct obj_data *wielded = GET_EQ(ch, WEAR_WIELD);

Now, should this not be changed to read:

void double_hit(struct char_data * ch, struct char_data * victim, int type)
{
        struct obj_data *wielded = GET_EQ(ch, WEAR_DWIELD);

Notice that WEAR_WIELD has been changed to WEAR_DWIELD, since we are dealing
with the 2nd weapon.

OK, so I did that, but nothing happened.

Then I tried changing *wielded to *dual_wielded everywhere in this function,
and that did the trick.

So, my question is, Did I have to do this because *wielded was set by
the hit() function, which is the parent of the double_hit function?
My c's very rusty (PERL munger for years), so I'm not sure why.

Anyway, someone can clear this up for me.
The patch is GREAT, BTW.  Highly recommended.
All of the ones I've found have been.

And, of course, everyone's getting credit in my credits file, and I'll e-mail
everyone when the MUD's out of alpha.
Oh the fun things you can do with DSL and a home network!
8-)

Thanks again!
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