Skip to content

Commit

Permalink
Fix: hatching wielded/quivered egg called weight()
Browse files Browse the repository at this point in the history
According to vanilla code, it is not a bug for setnotworn to be called
with a hatching egg that has already had its quan changed to 0. So this
fixes it inside setworn, only recalculating the object's weight if it
was worn armor. (If someone manages to wear an egg as armor, that will
be a worse bug than this.)
  • Loading branch information
copperwater committed May 22, 2023
1 parent a1e01fd commit a6e359a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/worn.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,11 @@ setnotworn(struct obj *obj)
p = armor_provides_extrinsic(obj);
u.uprops[p].extrinsic = u.uprops[p].extrinsic & ~wp->w_mask;
obj->owornmask &= ~wp->w_mask;
obj->owt = weight(obj); /* remove armor weight reduction */
if (wp->w_mask & W_ARMOR)
/* this function can technically be called with wielded or
* quivered egg in the process of hatching, which is not worn
* armor */
obj->owt = weight(obj); /* remove armor weight reduction */
if (obj->oartifact)
set_artifact_intrinsic(obj, 0, wp->w_mask);
if ((p = w_blocks(obj, wp->w_mask)) != 0)
Expand Down

0 comments on commit a6e359a

Please sign in to comment.