Re: [CODE]Freweapon Help

From: Hans H. Hjort (hjort@S-96-226.RESNET.OHIO-STATE.EDU)
Date: 12/08/97


On Mon, 8 Dec 1997, Demond LaZaro wrote:

Its one of those mistakes that make you want to bang you head against the
wall once you see it. :) I'm assuming object value 0 holds the number of
rounds.

> Heres the code:
> void perform_load(struct char_data * ch, struct obj_data * ammo,
>                       struct obj_data * gun)
> {
>     GET_OBJ_VAL(ammo, 0) += GET_OBJ_VAL(gun, 0);

This line adds the number of rounds the gun contains to the ammo object.
What you want is:
      GET_OBJ_VAL(gun, 0) += GET_OBJ_VAL(ammo, 0);
This will add the rounds to the gun.

>     act("You load $p into $P.", FALSE, ch, ammo, gun, TO_CHAR);
>     act("$n loads $p into $P.", TRUE, ch, ammo, gun, TO_ROOM);
>     extract_obj(ammo);
> }
>

[snip]

> Help?


                                                -Hans


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



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