]> granicus.if.org Git - nethack/commitdiff
Merge branch 'master' into win32-x64-working
authornhmall <mjnh@persona.ca>
Sun, 12 Apr 2015 04:15:40 +0000 (00:15 -0400)
committernhmall <mjnh@persona.ca>
Sun, 12 Apr 2015 04:15:40 +0000 (00:15 -0400)
Conflicts:
include/config.h
include/extern.h
src/do.c
src/files.c
src/hack.c
src/mkobj.c
src/mon.c
src/objnam.c
src/vision.c
sys/share/pcmain.c
win/share/other.txt
win/share/renumtiles.pl

26 files changed:
1  2 
include/config.h
include/extern.h
include/flag.h
include/sys.h
src/do.c
src/do_name.c
src/eat.c
src/end.c
src/files.c
src/hack.c
src/mklev.c
src/mkmaze.c
src/mkobj.c
src/mon.c
src/options.c
src/pickup.c
src/read.c
src/restore.c
src/sp_lev.c
src/trap.c
src/zap.c
sys/share/pcmain.c
sys/unix/sysconf
util/lev_comp.l
util/makedefs.c
win/tty/wintty.c

Simple merge
index 3600d64605f84f309ae9c68456cf9d7b9bab8384,7192bba42fa3b5f3a104c4f9c2ebf76fd0e61598..b0dded626adea11a36bb212f590919cef16c24e2
@@@ -1,4 -1,5 +1,4 @@@
- /* NetHack 3.5        extern.h        $NHDT-Date: 1426966688 2015/03/21 19:38:08 $  $NHDT-Branch: master $:$NHDT-Revision: 1.411 $ */
+ /* NetHack 3.5        extern.h        $NHDT-Date: 1428715841 2015/04/11 01:30:41 $  $NHDT-Branch: master $:$NHDT-Revision: 1.454 $ */
 -/* NetHack 3.5        extern.h        $Date: 2013/11/05 00:57:53 $  $Revision: 1.380 $ */
  /* Copyright (c) Steve Creps, 1988.                             */
  /* NetHack may be freely redistributed.  See license for details. */
  
diff --cc include/flag.h
Simple merge
diff --cc include/sys.h
Simple merge
diff --cc src/do.c
Simple merge
diff --cc src/do_name.c
Simple merge
diff --cc src/eat.c
Simple merge
diff --cc src/end.c
Simple merge
diff --cc src/files.c
index 644dfca8789f99648c8a48fda16653d44635b4f7,1ed9a3c052e5e98214d279bd645d1b7ec6bbba0f..d5646a16449f2f6a969b260a1b4609037c22b1fd
@@@ -1,5 -1,5 +1,5 @@@
- /* NetHack 3.5        files.c $NHDT-Date: 1426969026 2015/03/21 20:17:06 $  $NHDT-Branch: master $:$NHDT-Revision: 1.137 $ */
+ /* NetHack 3.5        files.c $NHDT-Date: 1427337311 2015/03/26 02:35:11 $  $NHDT-Branch: derek-farming $:$NHDT-Revision: 1.141 $ */
 -/* NetHack 3.5        files.c $Date: 2012/03/10 02:49:08 $  $Revision: 1.124 $ */
 +
  /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
  /* NetHack may be freely redistributed.  See license for details. */
  
diff --cc src/hack.c
index b517b7822206144b348ebefc60064f26bb0bf704,ebf1ce891f624a25396e35c0ede6e4c3844854e9..97673560049e2bb75a19d4050fa7d977dde26881
@@@ -1101,491 -1101,491 +1101,491 @@@ struct trap *desttrap;    /* nonnull if an
  void
  domove()
  {
-       register struct monst *mtmp;
-       register struct rm *tmpr;
-       register xchar x,y;
+     register struct monst *mtmp;
+     register struct rm *tmpr;
+     register xchar x,y;
 -      struct trap *trap = (struct trap *)0;
 +      struct trap *trap = NULL;
-       int wtcap;
-       boolean on_ice;
-       xchar chainx, chainy, ballx, bally;     /* ball&chain new positions */
-       int bc_control;                         /* control for ball&chain */
-       boolean cause_delay = FALSE;    /* dragging ball will skip a move */
-       u_wipe_engr(rnd(5));
-       if (context.travel) {
-           if (!findtravelpath(FALSE))
-               (void) findtravelpath(TRUE);
-           context.travel1 = 0;
-       }
-       if(((wtcap = near_capacity()) >= OVERLOADED
-           || (wtcap > SLT_ENCUMBER &&
-               (Upolyd ? (u.mh < 5 && u.mh != u.mhmax)
-                       : (u.uhp < 10 && u.uhp != u.uhpmax))))
-          && !Is_airlevel(&u.uz)) {
-           if(wtcap < OVERLOADED) {
-               You("don't have enough stamina to move.");
-               exercise(A_CON, FALSE);
-           } else
-               You("collapse under your load.");
-           nomul(0);
-           return;
-       }
-       if(u.uswallow) {
-               u.dx = u.dy = 0;
-               u.ux = x = u.ustuck->mx;
-               u.uy = y = u.ustuck->my;
-               mtmp = u.ustuck;
-       } else {
-               if (Is_airlevel(&u.uz) && rn2(4) &&
-                       !Levitation && !Flying) {
-                   switch(rn2(3)) {
-                   case 0:
-                       You("tumble in place.");
-                       exercise(A_DEX, FALSE);
-                       break;
-                   case 1:
-                       You_cant("control your movements very well."); break;
-                   case 2:
-                       pline("It's hard to walk in thin air.");
-                       exercise(A_DEX, TRUE);
-                       break;
-                   }
-                   return;
-               }
-               /* check slippery ice */
-               on_ice = !Levitation && is_ice(u.ux, u.uy);
-               if (on_ice) {
-                   static int skates = 0;
-                   if (!skates) skates = find_skates();
-                   if ((uarmf && uarmf->otyp == skates)
-                           || resists_cold(&youmonst) || Flying
-                           || is_floater(youmonst.data) || is_clinger(youmonst.data)
-                           || is_whirly(youmonst.data))
-                       on_ice = FALSE;
-                   else if (!rn2(Cold_resistance ? 3 : 2)) {
-                       HFumbling |= FROMOUTSIDE;
-                       HFumbling &= ~TIMEOUT;
-                       HFumbling += 1;  /* slip on next move */
-                   }
-               }
-               if (!on_ice && (HFumbling & FROMOUTSIDE))
-                   HFumbling &= ~FROMOUTSIDE;
-               x = u.ux + u.dx;
-               y = u.uy + u.dy;
-               if(Stunned || (Confusion && !rn2(5))) {
-                       register int tries = 0;
-                       do {
-                               if(tries++ > 50) {
-                                       nomul(0);
-                                       return;
-                               }
-                               confdir();
-                               x = u.ux + u.dx;
-                               y = u.uy + u.dy;
-                       } while(!isok(x, y) || bad_rock(youmonst.data, x, y));
-               }
-               /* turbulence might alter your actual destination */
-               if (u.uinwater) {
-                       water_friction();
-                       if (!u.dx && !u.dy) {
-                               nomul(0);
-                               return;
-                       }
-                       x = u.ux + u.dx;
-                       y = u.uy + u.dy;
-               }
-               if(!isok(x, y)) {
-                       nomul(0);
-                       return;
-               }
-               if (((trap = t_at(x, y)) && trap->tseen) ||
-                   (Blind && !Levitation && !Flying &&
-                    !is_clinger(youmonst.data) &&
-                    is_pool_or_lava(x, y) && levl[x][y].seenv)) {
-                       if(context.run >= 2) {
-                               nomul(0);
-                               context.move = 0;
-                               return;
-                       } else
-                               nomul(0);
-               }
-               if (u.ustuck && (x != u.ustuck->mx || y != u.ustuck->my)) {
-                   if (distu(u.ustuck->mx, u.ustuck->my) > 2) {
-                       /* perhaps it fled (or was teleported or ... ) */
-                       u.ustuck = 0;
-                   } else if (sticks(youmonst.data)) {
-                       /* When polymorphed into a sticking monster,
-                        * u.ustuck means it's stuck to you, not you to it.
-                        */
-                       You("release %s.", mon_nam(u.ustuck));
-                       u.ustuck = 0;
-                   } else {
-                       /* If holder is asleep or paralyzed:
-                        *      37.5% chance of getting away,
-                        *      12.5% chance of waking/releasing it;
-                        * otherwise:
-                        *       7.5% chance of getting away.
-                        * [strength ought to be a factor]
-                        * If holder is tame and there is no conflict,
-                        * guaranteed escape.
-                        */
-                       switch (rn2(!u.ustuck->mcanmove ? 8 : 40)) {
-                       case 0: case 1: case 2:
-                       pull_free:
-                           You("pull free from %s.", mon_nam(u.ustuck));
-                           u.ustuck = 0;
-                           break;
-                       case 3:
-                           if (!u.ustuck->mcanmove) {
-                               /* it's free to move on next turn */
-                               u.ustuck->mfrozen = 1;
-                               u.ustuck->msleeping = 0;
-                           }
-                           /*FALLTHRU*/
-                       default:
-                           if (u.ustuck->mtame &&
-                               !Conflict && !u.ustuck->mconf)
-                               goto pull_free;
-                           You("cannot escape from %s!", mon_nam(u.ustuck));
-                           nomul(0);
-                           return;
-                       }
-                   }
-               }
-               mtmp = m_at(x,y);
-               if (mtmp) {
-                       /* Don't attack if you're running, and can see it */
-                       /* We should never get here if forcefight */
-                       if (context.run &&
-                           ((!Blind && mon_visible(mtmp) &&
-                             ((mtmp->m_ap_type != M_AP_FURNITURE &&
-                               mtmp->m_ap_type != M_AP_OBJECT) ||
-                              Protection_from_shape_changers)) ||
-                            sensemon(mtmp))) {
-                               nomul(0);
-                               context.move = 0;
-                               return;
-                       }
-               }
-       }
-       u.ux0 = u.ux;
-       u.uy0 = u.uy;
-       bhitpos.x = x;
-       bhitpos.y = y;
-       tmpr = &levl[x][y];
-       /* attack monster */
-       if(mtmp) {
-           nomul(0);
-           /* only attack if we know it's there */
-           /* or if we used the 'F' command to fight blindly */
-           /* or if it hides_under, in which case we call attack() to print
-            * the Wait! message.
-            * This is different from ceiling hiders, who aren't handled in
-            * attack().
-            */
-           /* If they used a 'm' command, trying to move onto a monster
-            * prints the below message and wastes a turn.  The exception is
-            * if the monster is unseen and the player doesn't remember an
-            * invisible monster--then, we fall through to attack() and
-            * attack_check(), which still wastes a turn, but prints a
-            * different message and makes the player remember the monster.                  */
-           if(context.nopick &&
-                 (canspotmon(mtmp) || glyph_is_invisible(levl[x][y].glyph))){
-               if(mtmp->m_ap_type && !Protection_from_shape_changers
-                                                   && !sensemon(mtmp))
-                   stumble_onto_mimic(mtmp);
-               else if (mtmp->mpeaceful && !Hallucination)
-                   pline("Pardon me, %s.", m_monnam(mtmp));
-               else
-                   You("move right into %s.", mon_nam(mtmp));
-               return;
-           }
-           if(context.forcefight || !mtmp->mundetected || sensemon(mtmp) ||
-                   ((hides_under(mtmp->data) || mtmp->data->mlet == S_EEL) &&
-                       !is_safepet(mtmp))){
-               /* try to attack; note that it might evade */
-               /* also, we don't attack tame when _safepet_ */
-               if(attack(mtmp)) return;
-           }
-       }
-       /* specifying 'F' with no monster wastes a turn */
-       if (context.forcefight ||
-           /* remembered an 'I' && didn't use a move command */
-           (glyph_is_invisible(levl[x][y].glyph) && !context.nopick)) {
-               struct obj *boulder = sobj_at(BOULDER, x, y);
-               boolean explo = (Upolyd && attacktype(youmonst.data, AT_EXPL)),
-                       solid = !accessible(x, y);
-               int glyph = glyph_at(x, y);     /* might be monster */
-               char buf[BUFSZ];
-               /* if a statue is displayed at the target location,
-                  player is attempting to attack it [and boulder
-                  handlng below is suitable for handling that] */
-               if (glyph_is_statue(glyph) ||
-                       (Hallucination && glyph_is_monster(glyph)))
-                   boulder = sobj_at(STATUE, x, y);
-               /* force fight at boulder/statue or wall/door while wielding
-                  pick:  start digging to break the boulder or wall */
-               if (context.forcefight &&
-                       /* can we dig? */
-                       uwep && dig_typ(uwep, x, y) &&
-                       /* should we dig? */
-                       !glyph_is_invisible(glyph) &&
-                       !glyph_is_monster(glyph)) {
-                   (void)use_pick_axe2(uwep);
-                   return;
-               }
-               if (boulder)
-                   Strcpy(buf, ansimpleoname(boulder));
-               else if (solid)
-                   Strcpy(buf, the(defsyms[glyph_to_cmap(glyph)].explanation));
-               else if (!Underwater)
-                   Strcpy(buf, "thin air");
-               else if (is_pool(x, y))
-                   Strcpy(buf, "empty water");
-               else    /* Underwater, targetting non-water */
-                   Sprintf(buf, "a vacant spot on the %s", surface(x,y));
-               You("%s%s %s.",
-                   !(boulder || solid) ? "" :
-                       !explo ? "harmlessly " : "futilely ",
-                   explo ? "explode at" : "attack",
-                   buf);
-               unmap_object(x, y); /* known empty -- remove 'I' if present */
-               if (boulder) map_object(boulder, TRUE);
-               newsym(x, y);
-               nomul(0);
-               if (explo) {
-                   wake_nearby();
-                   u.mh = -1;          /* dead in the current form */
-                   rehumanize();
-               }
-               return;
-       }
-       if (glyph_is_invisible(levl[x][y].glyph)) {
-           unmap_object(x, y);
-           newsym(x, y);
-       }
-       /* not attacking an animal, so we try to move */
-       if ((u.dx || u.dy) && u.usteed && stucksteed(FALSE)) {
-               nomul(0);
-               return;
-       }
-       if(!youmonst.data->mmove) {
-               You("are rooted %s.",
-                   Levitation || Is_airlevel(&u.uz) || Is_waterlevel(&u.uz) ?
-                   "in place" : "to the ground");
-               nomul(0);
-               return;
-       }
-       if(u.utrap) {
-           if (!trapmove(x, y, trap)) return;
-       }
-       if (!test_move(u.ux, u.uy, x-u.ux, y-u.uy, DO_MOVE)) {
-           context.move = 0;
-           nomul(0);
-           return;
-       }
-       /* Move ball and chain.  */
-       if (Punished)
-           if (!drag_ball(x,y, &bc_control, &ballx, &bally, &chainx, &chainy,
-                       &cause_delay, TRUE))
-               return;
-       /* Check regions entering/leaving */
-       if (!in_out_region(x,y))
-           return;
-       /* now move the hero */
-       mtmp = m_at(x, y);
-       u.ux += u.dx;
-       u.uy += u.dy;
-       /* Move your steed, too */
-       if (u.usteed) {
-               u.usteed->mx = u.ux;
-               u.usteed->my = u.uy;
-               exercise_steed();
-       }
-       /*
-        * If safepet at destination then move the pet to the hero's
-        * previous location using the same conditions as in attack().
-        * there are special extenuating circumstances:
-        * (1) if the pet dies then your god angers,
-        * (2) if the pet gets trapped then your god may disapprove,
-        * (3) if the pet was already trapped and you attempt to free it
-        * not only do you encounter the trap but you may frighten your
-        * pet causing it to go wild!  moral: don't abuse this privilege.
-        *
-        * Ceiling-hiding pets are skipped by this section of code, to
-        * be caught by the normal falling-monster code.
-        */
-       if (is_safepet(mtmp) && !(is_hider(mtmp->data) && mtmp->mundetected)) {
-           /* if trapped, there's a chance the pet goes wild */
-           if (mtmp->mtrapped) {
-               if (!rn2(mtmp->mtame)) {
-                   mtmp->mtame = mtmp->mpeaceful = mtmp->msleeping = 0;
-                   if (mtmp->mleashed) m_unleash(mtmp, TRUE);
-                   growl(mtmp);
-               } else {
-                   yelp(mtmp);
-               }
-           }
-           mtmp->mundetected = 0;
-           if (mtmp->m_ap_type) seemimic(mtmp);
-           else if (!mtmp->mtame) newsym(mtmp->mx, mtmp->my);
-           if (mtmp->mtrapped &&
-                   (trap = t_at(mtmp->mx, mtmp->my)) != 0 &&
-                   (trap->ttyp == PIT || trap->ttyp == SPIKED_PIT) &&
-                   sobj_at(BOULDER, trap->tx, trap->ty)) {
-               /* can't swap places with pet pinned in a pit by a boulder */
-               u.ux = u.ux0,  u.uy = u.uy0;    /* didn't move after all */
-           } else if (u.ux0 != x && u.uy0 != y && NODIAG(mtmp->data - mons)) {
-               /* can't swap places when pet can't move to your spot */
-               u.ux = u.ux0,  u.uy = u.uy0;
-               You("stop.  %s can't move diagonally.",
-                   upstart(y_monnam(mtmp)));
-           } else if (u.ux0 != x && u.uy0 != y &&
-                      bad_rock(mtmp->data, x, u.uy0) &&
-                      bad_rock(mtmp->data, u.ux0, y) &&
-                      (bigmonst(mtmp->data) || (curr_mon_load(mtmp) > 600))) {
-               /* can't swap places when pet won't fit thru the opening */
-               u.ux = u.ux0,  u.uy = u.uy0;    /* didn't move after all */
-               You("stop.  %s won't fit through.", upstart(y_monnam(mtmp)));
-           } else {
-               char pnambuf[BUFSZ];
-               /* save its current description in case of polymorph */
-               Strcpy(pnambuf, y_monnam(mtmp));
-               mtmp->mtrapped = 0;
-               remove_monster(x, y);
-               place_monster(mtmp, u.ux0, u.uy0);
-               newsym(x, y);
-               newsym(u.ux0, u.uy0);
-               You("%s %s.", mtmp->mtame ? "swap places with" : "frighten",
-                   pnambuf);
-               /* check for displacing it into pools and traps */
-               switch (minliquid(mtmp) ? 2 : mintrap(mtmp)) {
-               case 0:
-                   break;
-               case 1:         /* trapped */
-               case 3:         /* changed levels */
-                   /* there's already been a trap message, reinforce it */
-                   abuse_dog(mtmp);
-                   adjalign(-3);
-                   break;
-               case 2:
-                   /* drowned or died...
-                    * you killed your pet by direct action, so get experience
-                    * and possibly penalties;
-                    * we want the level gain message, if it happens, to occur
-                    * before the guilt message below
-                    */
-                 {
-                   /* minliquid() and mintrap() call mondead() rather than
-                      killed() so we duplicate some of the latter here */
-                   int tmp, mndx;
-                   u.uconduct.killer++;
-                   mndx = monsndx(mtmp->data);
-                   tmp = experience(mtmp, (int)mvitals[mndx].died);
-                   more_experienced(tmp, 0);
-                   newexplevel();      /* will decide if you go up */
-                 }
-                   /* That's no way to treat a pet!  Your god gets angry.
-                    *
-                    * [This has always been pretty iffy.  Why does your
-                    * patron deity care at all, let alone enough to get mad?]
-                    */
-                   if (rn2(4)) {
-                       You_feel("guilty about losing your pet like this.");
-                       u.ugangr++;
-                       adjalign(-15);
-                   }
-                   break;
-               default:
-                   pline("that's strange, unknown mintrap result!");
-                   break;
-               }
-           }
-       }
-       reset_occupations();
-       if (context.run) {
-           if ( context.run < 8 )
-               if (IS_DOOR(tmpr->typ) || IS_ROCK(tmpr->typ) ||
-                       IS_FURNITURE(tmpr->typ))
-                   nomul(0);
-       }
-       if (hides_under(youmonst.data) || (youmonst.data->mlet == S_EEL) ||
-           u.dx || u.dy)
-           (void) hideunder(&youmonst);
-       /*
-        * Mimics (or whatever) become noticeable if they move and are
-        * imitating something that doesn't move.  We could extend this
-        * to non-moving monsters...
-        */
-       if ((u.dx || u.dy) && (youmonst.m_ap_type == M_AP_OBJECT
-                               || youmonst.m_ap_type == M_AP_FURNITURE))
-           youmonst.m_ap_type = M_AP_NOTHING;
-       check_leash(u.ux0,u.uy0);
-       if(u.ux0 != u.ux || u.uy0 != u.uy) {
-           u.umoved = TRUE;
-           /* Clean old position -- vision_recalc() will print our new one. */
-           newsym(u.ux0,u.uy0);
-           /* Since the hero has moved, adjust what can be seen/unseen. */
-           vision_recalc(1);   /* Do the work now in the recover time. */
-           invocation_message();
-       }
-       if (Punished)                           /* put back ball and chain */
-           move_bc(0,bc_control,ballx,bally,chainx,chainy);
-       spoteffects(TRUE);
-       /* delay next move because of ball dragging */
-       /* must come after we finished picking up, in spoteffects() */
-       if (cause_delay) {
-           nomul(-2);
+     int wtcap;
+     boolean on_ice;
+     xchar chainx, chainy, ballx, bally;       /* ball&chain new positions */
+     int bc_control;                           /* control for ball&chain */
+     boolean cause_delay = FALSE;      /* dragging ball will skip a move */
+     u_wipe_engr(rnd(5));
+     if (context.travel) {
+         if (!findtravelpath(FALSE))
+         (void) findtravelpath(TRUE);
+         context.travel1 = 0;
+     }
+     if(((wtcap = near_capacity()) >= OVERLOADED
+         || (wtcap > SLT_ENCUMBER &&
+         (Upolyd ? (u.mh < 5 && u.mh != u.mhmax)
+             : (u.uhp < 10 && u.uhp != u.uhpmax))))
+        && !Is_airlevel(&u.uz)) {
+         if(wtcap < OVERLOADED) {
+         You("don't have enough stamina to move.");
+         exercise(A_CON, FALSE);
+         } else
+         You("collapse under your load.");
+         nomul(0);
+         return;
+     }
+     if(u.uswallow) {
+         u.dx = u.dy = 0;
+         u.ux = x = u.ustuck->mx;
+         u.uy = y = u.ustuck->my;
+         mtmp = u.ustuck;
+     } else {
+         if (Is_airlevel(&u.uz) && rn2(4) &&
+             !Levitation && !Flying) {
+             switch(rn2(3)) {
+             case 0:
+             You("tumble in place.");
+             exercise(A_DEX, FALSE);
+             break;
+             case 1:
+             You_cant("control your movements very well."); break;
+             case 2:
+             pline("It's hard to walk in thin air.");
+             exercise(A_DEX, TRUE);
+             break;
+             }
+             return;
+         }
+         /* check slippery ice */
+         on_ice = !Levitation && is_ice(u.ux, u.uy);
+         if (on_ice) {
+             static int skates = 0;
+             if (!skates) skates = find_skates();
+             if ((uarmf && uarmf->otyp == skates)
+                 || resists_cold(&youmonst) || Flying
+                 || is_floater(youmonst.data) || is_clinger(youmonst.data)
+                 || is_whirly(youmonst.data))
+             on_ice = FALSE;
+             else if (!rn2(Cold_resistance ? 3 : 2)) {
+             HFumbling |= FROMOUTSIDE;
+             HFumbling &= ~TIMEOUT;
+             HFumbling += 1;  /* slip on next move */
+             }
+         }
+         if (!on_ice && (HFumbling & FROMOUTSIDE))
+             HFumbling &= ~FROMOUTSIDE;
+         x = u.ux + u.dx;
+         y = u.uy + u.dy;
+         if(Stunned || (Confusion && !rn2(5))) {
+             register int tries = 0;
+             do {
+                 if(tries++ > 50) {
+                     nomul(0);
+                     return;
+                 }
+                 confdir();
+                 x = u.ux + u.dx;
+                 y = u.uy + u.dy;
+             } while(!isok(x, y) || bad_rock(youmonst.data, x, y));
+         }
+         /* turbulence might alter your actual destination */
+         if (u.uinwater) {
+             water_friction();
+             if (!u.dx && !u.dy) {
+                 nomul(0);
+                 return;
+             }
+             x = u.ux + u.dx;
+             y = u.uy + u.dy;
+         }
+         if(!isok(x, y)) {
+             nomul(0);
+             return;
+         }
+         if (((trap = t_at(x, y)) && trap->tseen) ||
+             (Blind && !Levitation && !Flying &&
+              !is_clinger(youmonst.data) &&
+              is_pool_or_lava(x, y) && levl[x][y].seenv)) {
+             if(context.run >= 2) {
+                 nomul(0);
+                 context.move = 0;
+                 return;
+             } else
+                 nomul(0);
+         }
+         if (u.ustuck && (x != u.ustuck->mx || y != u.ustuck->my)) {
+             if (distu(u.ustuck->mx, u.ustuck->my) > 2) {
+             /* perhaps it fled (or was teleported or ... ) */
+             u.ustuck = 0;
+             } else if (sticks(youmonst.data)) {
+             /* When polymorphed into a sticking monster,
+              * u.ustuck means it's stuck to you, not you to it.
+              */
+             You("release %s.", mon_nam(u.ustuck));
+             u.ustuck = 0;
+             } else {
+             /* If holder is asleep or paralyzed:
+              *        37.5% chance of getting away,
+              *        12.5% chance of waking/releasing it;
+              * otherwise:
+              *         7.5% chance of getting away.
+              * [strength ought to be a factor]
+              * If holder is tame and there is no conflict,
+              * guaranteed escape.
+              */
+             switch (rn2(!u.ustuck->mcanmove ? 8 : 40)) {
+             case 0: case 1: case 2:
+             pull_free:
+                 You("pull free from %s.", mon_nam(u.ustuck));
+                 u.ustuck = 0;
+                 break;
+             case 3:
+                 if (!u.ustuck->mcanmove) {
+                 /* it's free to move on next turn */
+                 u.ustuck->mfrozen = 1;
+                 u.ustuck->msleeping = 0;
+                 }
+                 /*FALLTHRU*/
+             default:
+                 if (u.ustuck->mtame &&
+                 !Conflict && !u.ustuck->mconf)
+                 goto pull_free;
+                 You("cannot escape from %s!", mon_nam(u.ustuck));
+                 nomul(0);
+                 return;
+             }
+             }
+         }
+         mtmp = m_at(x,y);
+         if (mtmp) {
+             /* Don't attack if you're running, and can see it */
+             /* We should never get here if forcefight */
+             if (context.run &&
+                 ((!Blind && mon_visible(mtmp) &&
+                   ((mtmp->m_ap_type != M_AP_FURNITURE &&
+                 mtmp->m_ap_type != M_AP_OBJECT) ||
+                    Protection_from_shape_changers)) ||
+                  sensemon(mtmp))) {
+                 nomul(0);
+                 context.move = 0;
+                 return;
+             }
+         }
+     }
+     u.ux0 = u.ux;
+     u.uy0 = u.uy;
+     bhitpos.x = x;
+     bhitpos.y = y;
+     tmpr = &levl[x][y];
+     /* attack monster */
+     if(mtmp) {
+         nomul(0);
+         /* only attack if we know it's there */
+         /* or if we used the 'F' command to fight blindly */
+         /* or if it hides_under, in which case we call attack() to print
+          * the Wait! message.
+          * This is different from ceiling hiders, who aren't handled in
+          * attack().
+          */
+         /* If they used a 'm' command, trying to move onto a monster
+          * prints the below message and wastes a turn.  The exception is
+          * if the monster is unseen and the player doesn't remember an
+          * invisible monster--then, we fall through to attack() and
+          * attack_check(), which still wastes a turn, but prints a
+          * different message and makes the player remember the monster.                    */
+         if(context.nopick &&
+           (canspotmon(mtmp) || glyph_is_invisible(levl[x][y].glyph))){
+         if(mtmp->m_ap_type && !Protection_from_shape_changers
+                             && !sensemon(mtmp))
+             stumble_onto_mimic(mtmp);
+         else if (mtmp->mpeaceful && !Hallucination)
+             pline("Pardon me, %s.", m_monnam(mtmp));
+         else
+             You("move right into %s.", mon_nam(mtmp));
+         return;
+         }
+         if(context.forcefight || !mtmp->mundetected || sensemon(mtmp) ||
+             ((hides_under(mtmp->data) || mtmp->data->mlet == S_EEL) &&
+             !is_safepet(mtmp))){
+         /* try to attack; note that it might evade */
+         /* also, we don't attack tame when _safepet_ */
+         if(attack(mtmp)) return;
+         }
+     }
+     /* specifying 'F' with no monster wastes a turn */
+     if (context.forcefight ||
+         /* remembered an 'I' && didn't use a move command */
+         (glyph_is_invisible(levl[x][y].glyph) && !context.nopick)) {
+         struct obj *boulder = sobj_at(BOULDER, x, y);
+         boolean explo = (Upolyd && attacktype(youmonst.data, AT_EXPL)),
+             solid = !accessible(x, y);
+         int glyph = glyph_at(x, y);   /* might be monster */
+         char buf[BUFSZ];
+         /* if a statue is displayed at the target location,
+            player is attempting to attack it [and boulder
+            handlng below is suitable for handling that] */
+         if (glyph_is_statue(glyph) ||
+             (Hallucination && glyph_is_monster(glyph)))
+             boulder = sobj_at(STATUE, x, y);
+         /* force fight at boulder/statue or wall/door while wielding
+            pick:  start digging to break the boulder or wall */
+         if (context.forcefight &&
+             /* can we dig? */
+             uwep && dig_typ(uwep, x, y) &&
+             /* should we dig? */
+             !glyph_is_invisible(glyph) &&
+             !glyph_is_monster(glyph)) {
+             (void)use_pick_axe2(uwep);
+             return;
+         }
+         if (boulder)
+             Strcpy(buf, ansimpleoname(boulder));
+         else if (solid)
+             Strcpy(buf, the(defsyms[glyph_to_cmap(glyph)].explanation));
+         else if (!Underwater)
+             Strcpy(buf, "thin air");
+         else if (is_pool(x, y))
+             Strcpy(buf, "empty water");
+         else  /* Underwater, targetting non-water */
+             Sprintf(buf, "a vacant spot on the %s", surface(x,y));
+         You("%s%s %s.",
+             !(boulder || solid) ? "" :
+             !explo ? "harmlessly " : "futilely ",
+             explo ? "explode at" : "attack",
+             buf);
+         unmap_object(x, y); /* known empty -- remove 'I' if present */
+         if (boulder) map_object(boulder, TRUE);
+         newsym(x, y);
+         nomul(0);
+         if (explo) {
+             wake_nearby();
+             u.mh = -1;                /* dead in the current form */
+             rehumanize();
+         }
+         return;
+     }
+     if (glyph_is_invisible(levl[x][y].glyph)) {
+         unmap_object(x, y);
+         newsym(x, y);
+     }
+     /* not attacking an animal, so we try to move */
+     if ((u.dx || u.dy) && u.usteed && stucksteed(FALSE)) {
+         nomul(0);
+         return;
+     }
+     if(!youmonst.data->mmove) {
+         You("are rooted %s.",
+             Levitation || Is_airlevel(&u.uz) || Is_waterlevel(&u.uz) ?
+             "in place" : "to the ground");
+         nomul(0);
+         return;
+     }
+     if(u.utrap) {
+         if (!trapmove(x, y, trap)) return;
+     }
+     if (!test_move(u.ux, u.uy, x-u.ux, y-u.uy, DO_MOVE)) {
+         context.move = 0;
+         nomul(0);
+         return;
+     }
+     /* Move ball and chain.  */
+     if (Punished)
+         if (!drag_ball(x,y, &bc_control, &ballx, &bally, &chainx, &chainy,
+             &cause_delay, TRUE))
+         return;
+     /* Check regions entering/leaving */
+     if (!in_out_region(x,y))
+         return;
+     /* now move the hero */
+     mtmp = m_at(x, y);
+     u.ux += u.dx;
+     u.uy += u.dy;
+     /* Move your steed, too */
+     if (u.usteed) {
+         u.usteed->mx = u.ux;
+         u.usteed->my = u.uy;
+         exercise_steed();
+     }
+     /*
+      * If safepet at destination then move the pet to the hero's
+      * previous location using the same conditions as in attack().
+      * there are special extenuating circumstances:
+      * (1) if the pet dies then your god angers,
+      * (2) if the pet gets trapped then your god may disapprove,
+      * (3) if the pet was already trapped and you attempt to free it
+      * not only do you encounter the trap but you may frighten your
+      * pet causing it to go wild!  moral: don't abuse this privilege.
+      *
+      * Ceiling-hiding pets are skipped by this section of code, to
+      * be caught by the normal falling-monster code.
+      */
+     if (is_safepet(mtmp) && !(is_hider(mtmp->data) && mtmp->mundetected)) {
+         /* if trapped, there's a chance the pet goes wild */
+         if (mtmp->mtrapped) {
+         if (!rn2(mtmp->mtame)) {
+             mtmp->mtame = mtmp->mpeaceful = mtmp->msleeping = 0;
+             if (mtmp->mleashed) m_unleash(mtmp, TRUE);
+             growl(mtmp);
+         } else {
+             yelp(mtmp);
+         }
+         }
+         mtmp->mundetected = 0;
+         if (mtmp->m_ap_type) seemimic(mtmp);
+         else if (!mtmp->mtame) newsym(mtmp->mx, mtmp->my);
+         if (mtmp->mtrapped &&
+             (trap = t_at(mtmp->mx, mtmp->my)) != 0 &&
+             (trap->ttyp == PIT || trap->ttyp == SPIKED_PIT) &&
+             sobj_at(BOULDER, trap->tx, trap->ty)) {
+         /* can't swap places with pet pinned in a pit by a boulder */
+         u.ux = u.ux0,  u.uy = u.uy0;  /* didn't move after all */
+         } else if (u.ux0 != x && u.uy0 != y && NODIAG(mtmp->data - mons)) {
+         /* can't swap places when pet can't move to your spot */
+         u.ux = u.ux0,  u.uy = u.uy0;
+         You("stop.  %s can't move diagonally.",
+             upstart(y_monnam(mtmp)));
+         } else if (u.ux0 != x && u.uy0 != y &&
+                bad_rock(mtmp->data, x, u.uy0) &&
+                bad_rock(mtmp->data, u.ux0, y) &&
+                (bigmonst(mtmp->data) || (curr_mon_load(mtmp) > 600))) {
+         /* can't swap places when pet won't fit thru the opening */
+         u.ux = u.ux0,  u.uy = u.uy0;  /* didn't move after all */
+         You("stop.  %s won't fit through.", upstart(y_monnam(mtmp)));
+         } else {
+         char pnambuf[BUFSZ];
+         /* save its current description in case of polymorph */
+         Strcpy(pnambuf, y_monnam(mtmp));
+         mtmp->mtrapped = 0;
+         remove_monster(x, y);
+         place_monster(mtmp, u.ux0, u.uy0);
+         newsym(x, y);
+         newsym(u.ux0, u.uy0);
+         You("%s %s.", mtmp->mtame ? "swap places with" : "frighten",
+             pnambuf);
+         /* check for displacing it into pools and traps */
+         switch (minliquid(mtmp) ? 2 : mintrap(mtmp)) {
+         case 0:
+             break;
+         case 1:               /* trapped */
+         case 3:               /* changed levels */
+             /* there's already been a trap message, reinforce it */
+             abuse_dog(mtmp);
+             adjalign(-3);
+             break;
+         case 2:
+             /* drowned or died...
+              * you killed your pet by direct action, so get experience
+              * and possibly penalties;
+              * we want the level gain message, if it happens, to occur
+              * before the guilt message below
+              */
+           {
+             /* minliquid() and mintrap() call mondead() rather than
+                killed() so we duplicate some of the latter here */
+             int tmp, mndx;
+             u.uconduct.killer++;
+             mndx = monsndx(mtmp->data);
+             tmp = experience(mtmp, (int)mvitals[mndx].died);
+             more_experienced(tmp, 0);
+             newexplevel();    /* will decide if you go up */
+           }
+             /* That's no way to treat a pet!  Your god gets angry.
+              *
+              * [This has always been pretty iffy.  Why does your
+              * patron deity care at all, let alone enough to get mad?]
+              */
+             if (rn2(4)) {
+             You_feel("guilty about losing your pet like this.");
+             u.ugangr++;
+             adjalign(-15);
+             }
+             break;
+         default:
+             pline("that's strange, unknown mintrap result!");
+             break;
+         }
+         }
+     }
+     reset_occupations();
+     if (context.run) {
+         if ( context.run < 8 )
+         if (IS_DOOR(tmpr->typ) || IS_ROCK(tmpr->typ) ||
+             IS_FURNITURE(tmpr->typ))
+             nomul(0);
+     }
+     if (hides_under(youmonst.data) || (youmonst.data->mlet == S_EEL) ||
+         u.dx || u.dy)
+         (void) hideunder(&youmonst);
+     /*
+      * Mimics (or whatever) become noticeable if they move and are
+      * imitating something that doesn't move.  We could extend this
+      * to non-moving monsters...
+      */
+     if ((u.dx || u.dy) && (youmonst.m_ap_type == M_AP_OBJECT
+                 || youmonst.m_ap_type == M_AP_FURNITURE))
+         youmonst.m_ap_type = M_AP_NOTHING;
+     check_leash(u.ux0,u.uy0);
+     if(u.ux0 != u.ux || u.uy0 != u.uy) {
+         u.umoved = TRUE;
+         /* Clean old position -- vision_recalc() will print our new one. */
+         newsym(u.ux0,u.uy0);
+         /* Since the hero has moved, adjust what can be seen/unseen. */
+         vision_recalc(1);     /* Do the work now in the recover time. */
+         invocation_message();
+     }
+     if (Punished)                             /* put back ball and chain */
+         move_bc(0,bc_control,ballx,bally,chainx,chainy);
+     spoteffects(TRUE);
+     /* delay next move because of ball dragging */
+     /* must come after we finished picking up, in spoteffects() */
+     if (cause_delay) {
+         nomul(-2);
            multi_reason = "dragging an iron ball";
-           nomovemsg = "";
-       }
-       if (context.run && flags.runmode != RUN_TPORT) {
-           /* display every step or every 7th step depending upon mode */
-           if (flags.runmode != RUN_LEAP || !(moves % 7L)) {
-               if (flags.time) context.botl = 1;
-               curs_on_u();
-               delay_output();
-               if (flags.runmode == RUN_CRAWL) {
-                   delay_output();
-                   delay_output();
-                   delay_output();
-                   delay_output();
-               }
-           }
-       }
+         nomovemsg = "";
+     }
+     if (context.run && flags.runmode != RUN_TPORT) {
+         /* display every step or every 7th step depending upon mode */
+         if (flags.runmode != RUN_LEAP || !(moves % 7L)) {
+         if (flags.time) context.botl = 1;
+         curs_on_u();
+         delay_output();
+         if (flags.runmode == RUN_CRAWL) {
+             delay_output();
+             delay_output();
+             delay_output();
+             delay_output();
+         }
+         }
+     }
  }
  
  /* combat increases metabolism */
diff --cc src/mklev.c
Simple merge
diff --cc src/mkmaze.c
Simple merge
diff --cc src/mkobj.c
index 8de9031c9972e321da61183df4c96b3b3e83cb32,0fd6ab589bd3e3e61ad0474d89546938780b8dc9..17d5a58d1b69d3d8a1c0f4ffb2096d5cc3e7bd24
@@@ -1,4 -1,5 +1,4 @@@
- /* NetHack 3.5        mkobj.c $NHDT-Date: 1426465437 2015/03/16 00:23:57 $  $NHDT-Branch: debug $:$NHDT-Revision: 1.77 $ */
+ /* NetHack 3.5        mkobj.c $NHDT-Date: 1428715841 2015/04/11 01:30:41 $  $NHDT-Branch: master $:$NHDT-Revision: 1.91 $ */
 -/* NetHack 3.5        mkobj.c $Date: 2012/03/10 02:49:08 $  $Revision: 1.70 $ */
  /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
  /* NetHack may be freely redistributed.  See license for details. */
  
diff --cc src/mon.c
index 21452c974e1fdf49b50077ebea06fdb2196e64f3,93fef1b0c030a70afb86fc2fe4306f5a7bc3215d..914cf00988808c9f3022fe03f58e9d6ecaecfa6d
+++ b/src/mon.c
@@@ -1,4 -1,5 +1,4 @@@
- /* NetHack 3.5        mon.c   $NHDT-Date: 1427580482 2015/03/28 22:08:02 $  $NHDT-Branch: master $:$NHDT-Revision: 1.142 $ */
+ /* NetHack 3.5        mon.c   $NHDT-Date: 1426470347 2015/03/16 01:45:47 $  $NHDT-Branch: derek-farming $:$NHDT-Revision: 1.140 $ */
 -/* NetHack 3.5        mon.c   $Date: 2012/05/16 02:15:10 $  $Revision: 1.126 $ */
  /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
  /* NetHack may be freely redistributed.  See license for details. */
  
diff --cc src/options.c
Simple merge
diff --cc src/pickup.c
Simple merge
diff --cc src/read.c
Simple merge
diff --cc src/restore.c
Simple merge
diff --cc src/sp_lev.c
Simple merge
diff --cc src/trap.c
Simple merge
diff --cc src/zap.c
Simple merge
index e194b00e52b5864074b16d9b782206bdb5bfac22,412b6f9ebf23a96e77d940ccc7aace38859fe137..48cbae0294fa0c95870d6d1cad00ff92f7d2b64c
@@@ -1,4 -1,5 +1,4 @@@
- /* NetHack 3.5        pcmain.c        $NHDT-Date: 1426966701 2015/03/21 19:38:21 $  $NHDT-Branch: master $:$NHDT-Revision: 1.51 $ */
+ /* NetHack 3.5        pcmain.c        $NHDT-Date: 1427337317 2015/03/26 02:35:17 $  $NHDT-Branch: derek-farming $:$NHDT-Revision: 1.52 $ */
 -/* NetHack 3.5        pcmain.c        $Date: 2012/01/20 03:41:31 $  $Revision: 1.48 $ */
  /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
  /* NetHack may be freely redistributed.  See license for details. */
  
Simple merge
diff --cc util/lev_comp.l
Simple merge
diff --cc util/makedefs.c
Simple merge
Simple merge