From 2ff8b1687454478a006e86c2304c1281791e86ec Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Sat, 19 May 2007 04:09:01 +0000 Subject: [PATCH] fix #H333 - boulder theft From a bug report: nymphs could steal boulders even though they aren't allowed to pick those up. It happened becuase can_carry() is only called for monkeys (consequently, they don't have this problem), not for nymphs. --- doc/fixes34.4 | 1 + src/steal.c | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/fixes34.4 b/doc/fixes34.4 index 3743f7914..1d72589ff 100644 --- a/doc/fixes34.4 +++ b/doc/fixes34.4 @@ -354,6 +354,7 @@ an orc (or gnome) will respond to #chat if hero is also an orc (or gnome) kicking at "empty space" has side-effects so should use current turn using weapon to kill tame engulfer from inside triggered "placing defunct monster onto map?" warning +nymphs could steal carried boulders Platform- and/or Interface-Specific Fixes diff --git a/src/steal.c b/src/steal.c index 693b5249d..3ca65c16f 100644 --- a/src/steal.c +++ b/src/steal.c @@ -270,7 +270,7 @@ struct monst *mtmp; char *objnambuf; { struct obj *otmp; - int tmp, could_petrify, named = 0, armordelay; + int tmp, could_petrify, named = 0, armordelay, retrycnt = 0; boolean monkey_business; /* true iff an animal is doing the thievery */ if (objnambuf) *objnambuf = '\0'; @@ -304,6 +304,7 @@ nothing_to_steal: goto gotobj; } + retry: tmp = 0; for(otmp = invent; otmp; otmp = otmp->nobj) if ((!uarm || otmp != uarmc) && otmp != uskin @@ -343,6 +344,10 @@ nothing_to_steal: gotobj: if(otmp->o_id == stealoid) return(0); + if (otmp->otyp == BOULDER && !throws_rocks(mtmp->data)) { + if (!retrycnt++) goto retry; + goto cant_take; + } /* animals can't overcome curse stickiness nor unlock chains */ if (monkey_business) { boolean ostuck; -- 2.40.0