Skip to content

Commit

Permalink
Fix: mksobj_init could generate stack of multiple thiefstones
Browse files Browse the repository at this point in the history
thiefstone_init doesn't set the thiefstone's quan (as it shouldn't), and
the value was left uninitialized in a thiefstone's path through
mksobj_init. Fix this by explicitly setting quan to 1. Move the
thiefstone check up higher so the no-stacks-of-luckstones check doesn't
need to also check thiefstones.
  • Loading branch information
copperwater committed Apr 19, 2024
1 parent b9d77da commit 4179e8a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/mkobj.c
Original file line number Diff line number Diff line change
Expand Up @@ -1076,11 +1076,12 @@ mksobj_init(struct obj *otmp, boolean artif)
otmp->corpsenm = 0; /* LOADSTONE hack */
if (otmp->otyp == ROCK)
otmp->quan = (long) rn1(6, 6);
else if (otmp->otyp != LUCKSTONE && otmp->otyp != THIEFSTONE
&& !rn2(6))
otmp->quan = 2L;
else if (otmp->otyp == THIEFSTONE)
else if (otmp->otyp == THIEFSTONE) {
init_thiefstone(otmp);
otmp->quan = 1L;
}
else if (otmp->otyp != LUCKSTONE && !rn2(6))
otmp->quan = 2L;
else
otmp->quan = 1L;
break;
Expand Down

0 comments on commit 4179e8a

Please sign in to comment.