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.
This commit is contained in:
nethack.rankin
2007-05-19 04:09:01 +00:00
parent 4be43239a8
commit 2ff8b16874
2 changed files with 7 additions and 1 deletions
+1
View File
@@ -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 kicking at "empty space" has side-effects so should use current turn
using weapon to kill tame engulfer from inside triggered "placing defunct using weapon to kill tame engulfer from inside triggered "placing defunct
monster onto map?" warning monster onto map?" warning
nymphs could steal carried boulders
Platform- and/or Interface-Specific Fixes Platform- and/or Interface-Specific Fixes
+6 -1
View File
@@ -270,7 +270,7 @@ struct monst *mtmp;
char *objnambuf; char *objnambuf;
{ {
struct obj *otmp; 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 */ boolean monkey_business; /* true iff an animal is doing the thievery */
if (objnambuf) *objnambuf = '\0'; if (objnambuf) *objnambuf = '\0';
@@ -304,6 +304,7 @@ nothing_to_steal:
goto gotobj; goto gotobj;
} }
retry:
tmp = 0; tmp = 0;
for(otmp = invent; otmp; otmp = otmp->nobj) for(otmp = invent; otmp; otmp = otmp->nobj)
if ((!uarm || otmp != uarmc) && otmp != uskin if ((!uarm || otmp != uarmc) && otmp != uskin
@@ -343,6 +344,10 @@ nothing_to_steal:
gotobj: gotobj:
if(otmp->o_id == stealoid) return(0); 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 */ /* animals can't overcome curse stickiness nor unlock chains */
if (monkey_business) { if (monkey_business) {
boolean ostuck; boolean ostuck;