]> granicus.if.org Git - nethack/commitdiff
fix #H333 - boulder theft
authornethack.rankin <nethack.rankin>
Sat, 19 May 2007 04:09:01 +0000 (04:09 +0000)
committernethack.rankin <nethack.rankin>
Sat, 19 May 2007 04:09:01 +0000 (04:09 +0000)
     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
src/steal.c

index 3743f7914a17367bbf39fd2f01e1486e523f3bbe..1d72589ff1dc867630ee3cd0f7e63b26a0e0b5a0 100644 (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
 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
index 693b5249da37e1eaf7b3504bdc0053db6e6e5aa5..3ca65c16f9f4e139d11de162d480102a378cec76 100644 (file)
@@ -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;