Bug in enchant weapon?

From: Patrick Dughi (dughi@imaxx.net)
Date: 01/03/99


        While making a new patch recently, I noticed that the 'enchant
weapon' spell was a little funny looking... Though I don't have the code
directly infront of me, I do seem to remember seeing something that looked
like this:

    for (i = 0; i < MAX_OBJ_AFFECT; i++)
      if (obj->affected[i].location != APPLY_NONE)
        return;

        Which reads to me as:

        Return unless the first spot is free.

        Shouldn't this be something more like:

for (i = 0; i < MAX_OBJ_AFFECT && obj->affected[i].location != APPLY_NONE; i++);

        if(i == MAX_OBJ_AFFECT)
          return;

        Which reads something more like 'find the first free spot. If none
are free, then return'.

        To get more specific, it should look for 2 free spots, since
enchant weapon uses 2 affected spots, one for hit, one for damage...

        And to get even more nitpicky, the obj->affected[].location/modifer
lines below should use i and i+1, not 0 and 1.. else.. it will always
overwrite the first affection.  Not a problem with the current way its put
in, but thats cause you can't enchant an item with any previously existing
affectations...

                                                PjD


     +------------------------------------------------------------+
     | 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 : 12/15/00 PST