diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..7866ecd0b --- /dev/null +++ b/.travis.yml @@ -0,0 +1,52 @@ +language: c + +script: "cd sys/unix/ && sh setup.sh hints/$HINTS && cd ../../ && QT_SELECT=5 make MOC=moc install" + +matrix: + include: + - env: HINTS=linux + compiler: gcc + - env: HINTS=linux + compiler: clang + - env: HINTS=linux-x11 + compiler: gcc + - env: HINTS=linux-qt5 + compiler: gcc + addons: + apt: + packages: + - qtbase5-dev + - qtmultimedia5-dev + - qtbase5-dev-tools + - env: HINTS=linux-minimal + compiler: gcc + script: | + cd sys/unix/ && sh setup.sh hints/$HINTS && cd ../../ + sed -i '/^#define CLIPPING/d' include/config.h + sed -i '/^#define COMPRESS/d' include/config.h + #sed -i '/^#define DOAGAIN/d' include/config.h + sed -i '/^#define DUMPLOG/d' include/config.h + #sed -i '/^#define GDBPATH/d' include/config.h + #sed -i '/^#define GREPPATH/d' include/config.h + sed -i '/^#define INSURANCE/d' include/config.h + sed -i '/^#define LOGFILE/d' include/config.h + sed -i '/^#define NEWS/d' include/config.h + sed -i '/^#define PANICLOG/d' include/config.h + #sed -i '/^#define STATUS_HILITES/d' include/config.h + sed -i '/^#define SYSCF/d' include/config.h + sed -i '/^#define USER_SOUNDS/d' include/config.h + sed -i '/^#define XLOGFILE/d' include/config.h + + sed -i '/^#define MAIL/d' include/unixconf.h + sed -i '/^#define SHELL/d' include/unixconf.h + sed -i '/^#define SUSPEND/d' include/unixconf.h + sed -i 's/^#define TEXTCOLOR//' include/unixconf.h + make install + cat dat/options + +sudo: false + +notifications: + email: + recipients: + - devteam@nethack.org diff --git a/doc/fixes36.2 b/doc/fixes36.2 index 3f6bc996f..5e4d30edf 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -205,8 +205,23 @@ successfully paying for shop damage with shop credit would be followed by if a migrating monster was killed off because there was no room on the destination level, it would leave a corpse even if it was a type which should never leave one (demon, golem, blob, &c) +monsters accompanying hero during level change (usually pets) who failed to + arrive and tried to re-migrate were being removed from the map after + already having been removed [impossible "no monster to remove" if + compiled with EXTRA_SANITY_CHECKS enabled] during migration handling +monsters accompanying hero during level change (usually pets) who failed to + arrive and tried to re-migrate (for hero's next visit to the level) + ended up being killed because the migration attempt happened right + away (same visit by hero, so level still full) and they weren't + accompanying hero on the second attempt +fix for above (all failed arrivals will re-migrate) makes the earlier fix (for + invalid corpse being left by monst killed upon migration failure) moot end of game while carrying Schroedinger's Box would reveal cat-or-corpse for inventory disclosure or put that info into dumplog, but not both +attempting to untrap an adjacent trap while on the edge of--not in--a pit + failed due to not being able to reach the floor +magic trap's deafening roar effect wasn't waking nearby monsters +scattering of objects might leave source location with wrong thing displayed Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository diff --git a/include/config.h b/include/config.h index 4f242679a..d59a82af5 100644 --- a/include/config.h +++ b/include/config.h @@ -522,6 +522,10 @@ typedef unsigned char uchar; but it isn't necessary for successful operation of the program */ #define FREE_ALL_MEMORY /* free all memory at exit */ +/* EXTRA_SANITY_CHECKS adds extra impossible calls, + * probably not useful for normal play */ +/* #define EXTRA_SANITY_CHECKS */ + /* EDIT_GETLIN makes the string input in TTY, Qt4, and X11 so some prompts will remember the previously input text (within the same session) */ diff --git a/include/rm.h b/include/rm.h index d24c4e567..080677e15 100644 --- a/include/rm.h +++ b/include/rm.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 rm.h $NHDT-Date: 1432512776 2015/05/25 00:12:56 $ $NHDT-Branch: master $:$NHDT-Revision: 1.41 $ */ +/* NetHack 3.6 rm.h $NHDT-Date: 1543052680 2018/11/24 09:44:40 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.59 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Pasi Kallinen, 2017. */ /* NetHack may be freely redistributed. See license for details. */ @@ -630,14 +630,18 @@ extern dlevel_t level; /* structure describing the current level */ #define MON_BURIED_AT(x, y) \ (level.monsters[x][y] != (struct monst *) 0 \ && (level.monsters[x][y])->mburied) -#if EXTRA_SANITY_CHECKS -#define place_worm_seg(m, x, y) do { \ - if (level.monsters[x][y] && level.monsters[x][y] != m) impossible("place_worm_seg over mon"); \ - level.monsters[x][y] = m; \ +#ifdef EXTRA_SANITY_CHECKS +#define place_worm_seg(m, x, y) \ + do { \ + if (level.monsters[x][y] && level.monsters[x][y] != m) \ + impossible("place_worm_seg over mon"); \ + level.monsters[x][y] = m; \ } while(0) -#define remove_monster(x, y) do { \ - if (!level.monsters[x][y]) impossible("no monster to remove"); \ - level.monsters[x][y] = (struct monst *) 0; \ +#define remove_monster(x, y) \ + do { \ + if (!level.monsters[x][y]) \ + impossible("no monster to remove"); \ + level.monsters[x][y] = (struct monst *) 0; \ } while(0) #else #define place_worm_seg(m, x, y) level.monsters[x][y] = m diff --git a/src/detect.c b/src/detect.c index 57ee916ce..416c2611f 100644 --- a/src/detect.c +++ b/src/detect.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 detect.c $NHDT-Date: 1522891623 2018/04/05 01:27:03 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.81 $ */ +/* NetHack 3.6 detect.c $NHDT-Date: 1542853884 2018/11/22 02:31:24 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.87 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2018. */ /* NetHack may be freely redistributed. See license for details. */ @@ -165,8 +165,14 @@ char oclass; if (obj->oclass == oclass) return obj; - - if (Has_contents(obj)) { + /* + * Note: we exclude SchroedingersBox because the corpse it contains + * isn't necessarily a corpse yet. Resolving the status would lead + * to complications if it turns out to be a live cat. We know that + * that Box can't contain anything else because putting something in + * would resolve the cat/corpse situation and convert to ordinary box. + */ + if (Has_contents(obj) && !SchroedingersBox(obj)) { for (otmp = obj->cobj; otmp; otmp = otmp->nobj) if (otmp->oclass == oclass) return otmp; @@ -442,8 +448,7 @@ outgoldmap: return 0; } -/* returns 1 if nothing was detected */ -/* returns 0 if something was detected */ +/* returns 1 if nothing was detected, 0 if something was detected */ int food_detect(sobj) register struct obj *sobj; diff --git a/src/do.c b/src/do.c index 4bb739254..4817d150a 100644 --- a/src/do.c +++ b/src/do.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 do.c $NHDT-Date: 1542765356 2018/11/21 01:55:56 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.174 $ */ +/* NetHack 3.6 do.c $NHDT-Date: 1543052696 2018/11/24 09:44:56 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.175 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Derek S. Ray, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1446,10 +1446,9 @@ boolean at_stairs, falling, portal; with the situation, so only say something when debugging */ if (wizard) pline("(monster in hero's way)"); - if (!rloc(mtmp, TRUE) || m_at(u.ux, u.uy)) + if (!rloc(mtmp, TRUE) || (mtmp = m_at(u.ux, u.uy)) != 0) /* no room to move it; send it away, to return later */ - migrate_to_level(mtmp, ledger_no(&u.uz), MIGR_RANDOM, - (coord *) 0); + m_into_limbo(mtmp); } } diff --git a/src/dog.c b/src/dog.c index 0d967195e..93a33716e 100644 --- a/src/dog.c +++ b/src/dog.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 dog.c $NHDT-Date: 1502753406 2017/08/14 23:30:06 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.60 $ */ +/* NetHack 3.6 dog.c $NHDT-Date: 1543052701 2018/11/24 09:45:01 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.84 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */ /* NetHack may be freely redistributed. See license for details. */ @@ -224,7 +224,7 @@ update_mlstmv() void losedogs() { - register struct monst *mtmp, *mtmp0 = 0, *mtmp2; + register struct monst *mtmp, *mtmp0, *mtmp2; int dismissKops = 0; /* @@ -279,17 +279,26 @@ losedogs() mon_arrive(mtmp, TRUE); } - /* time for migrating monsters to arrive */ + /* time for migrating monsters to arrive; + monsters who belong on this level but fail to arrive get put + back onto the list (at head), so traversing it is tricky */ for (mtmp = migrating_mons; mtmp; mtmp = mtmp2) { mtmp2 = mtmp->nmon; if (mtmp->mux == u.uz.dnum && mtmp->muy == u.uz.dlevel) { - if (mtmp == migrating_mons) + /* remove mtmp from migrating_mons list */ + if (mtmp == migrating_mons) { migrating_mons = mtmp->nmon; - else - mtmp0->nmon = mtmp->nmon; + } else { + for (mtmp0 = migrating_mons; mtmp0; mtmp0 = mtmp0->nmon) + if (mtmp0->nmon == mtmp) { + mtmp0->nmon = mtmp->nmon; + break; + } + if (!mtmp0) + panic("losedogs: can't find migrating mon"); + } mon_arrive(mtmp, FALSE); - } else - mtmp0 = mtmp; + } } } @@ -300,9 +309,9 @@ struct monst *mtmp; boolean with_you; { struct trap *t; - struct obj *obj; xchar xlocale, ylocale, xyloc, xyflags, wander; int num_segs; + boolean failed_to_place = FALSE; mtmp->nmon = fmon; fmon = mtmp; @@ -328,7 +337,7 @@ boolean with_you; xyflags = mtmp->mtrack[0].y; xlocale = mtmp->mtrack[1].x; ylocale = mtmp->mtrack[1].y; - memset(mtmp->mtrack, 0, sizeof(mtmp->mtrack)); + memset(mtmp->mtrack, 0, sizeof mtmp->mtrack); if (mtmp == u.usteed) return; /* don't place steed on the map */ @@ -447,47 +456,13 @@ boolean with_you; mtmp->mx = 0; /*(already is 0)*/ mtmp->my = xyflags; - if (xlocale) { - if (!mnearto(mtmp, xlocale, ylocale, FALSE)) - goto fail_mon_placement; - } else { - if (!rloc(mtmp, TRUE)) { - /* - * Failed to place migrating monster, - * probably because the level is full. - * Dump the monster's cargo and leave the monster dead. - * - * TODO? Put back on migrating_mons list instead so - * that if hero leaves this level and then returns, - * monster will have another chance to arrive. - */ -fail_mon_placement: - while ((obj = mtmp->minvent) != 0) { - obj_extract_self(obj); - obj_no_longer_held(obj); - if (obj->owornmask & W_WEP) - setmnotwielded(mtmp, obj); - obj->owornmask = 0L; - if (xlocale && ylocale) - place_object(obj, xlocale, ylocale); - else if (rloco(obj)) { - if (!get_obj_location(obj, &xlocale, &ylocale, 0)) - impossible("Can't find relocated object."); - } - } - /* - * TODO? Maybe switch to make_corpse() [won't be needed if - * we re-migrate as suggested above], probably with new - * CORPSTAT_NOOBJS flag to suppress dragon scales and such. - */ - if (!(mvitals[monsndx(mtmp->data)].mvflags & G_NOCORPSE) - && !LEVEL_SPECIFIC_NOCORPSE(mtmp->data)) - (void) mkcorpstat(CORPSE, mtmp, mtmp->data, - xlocale, ylocale, CORPSTAT_NONE); - mtmp->mx = mtmp->my = 0; /* for mongone, mon is not anywhere */ - mongone(mtmp); - } - } + if (xlocale) + failed_to_place = !mnearto(mtmp, xlocale, ylocale, FALSE); + else + failed_to_place = !rloc(mtmp, TRUE); + + if (failed_to_place) + m_into_limbo(mtmp); /* try again next time hero comes to this level */ } /* heal monster for time spent elsewhere */ @@ -708,7 +683,7 @@ xchar tolev; /* destination level */ xchar xyloc; /* MIGR_xxx destination xy location: */ coord *cc; /* optional destination coordinates */ { - register struct obj *obj; + struct obj *obj; d_level new_lev; xchar xyflags; int num_segs = 0; /* count of worm segments */ @@ -717,12 +692,12 @@ coord *cc; /* optional destination coordinates */ set_residency(mtmp, TRUE); if (mtmp->wormno) { - register int cnt; + int cnt = count_wsegs(mtmp); + /* **** NOTE: worm is truncated to # segs = max wormno size **** */ - cnt = count_wsegs(mtmp); - num_segs = min(cnt, MAX_NUM_WORMS - 1); - wormgone(mtmp); - place_monster(mtmp, mtmp->mx, mtmp->my); + num_segs = min(cnt, MAX_NUM_WORMS - 1); /* used below */ + wormgone(mtmp); /* destroys tail and takes head off map */ + place_monster(mtmp, mtmp->mx, mtmp->my); /* put head back for relmon */ } /* set minvent's obj->no_charge to 0 */ @@ -755,7 +730,7 @@ coord *cc; /* optional destination coordinates */ mtmp->muy = new_lev.dlevel; mtmp->mx = mtmp->my = 0; /* this implies migration */ if (mtmp == context.polearm.hitmon) - context.polearm.hitmon = NULL; + context.polearm.hitmon = (struct monst *) 0; } /* return quality of food; the lower the better */ diff --git a/src/explode.c b/src/explode.c index fc2855c1d..46d3b327f 100644 --- a/src/explode.c +++ b/src/explode.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 explode.c $NHDT-Date: 1522454717 2018/03/31 00:05:17 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.56 $ */ +/* NetHack 3.6 explode.c $NHDT-Date: 1543101719 2018/11/24 23:21:59 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.59 $ */ /* Copyright (C) 1990 by Ken Arromdee */ /* NetHack may be freely redistributed. See license for details. */ @@ -616,6 +616,10 @@ struct obj *obj; /* only scatter this obj */ struct scatter_chain *schain = (struct scatter_chain *) 0; long total = 0L; + if (individual_object && (obj->ox != sx || obj->oy != sy)) + impossible("scattered object <%d,%d> not at scatter site <%d,%d>", + obj->ox, obj->oy, sx, sy); + while ((otmp = (individual_object ? obj : level.objects[sx][sy])) != 0) { if (otmp->quan > 1L) { qtmp = otmp->quan - 1L; @@ -759,7 +763,7 @@ struct obj *obj; /* only scatter this obj */ free((genericptr_t) stmp); newsym(x, y); } - + newsym(sx, sy); return total; } diff --git a/src/mon.c b/src/mon.c index 043b22e89..126f64f7b 100644 --- a/src/mon.c +++ b/src/mon.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 mon.c $NHDT-Date: 1539479657 2018/10/14 01:14:17 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.260 $ */ +/* NetHack 3.6 mon.c $NHDT-Date: 1543100460 2018/11/24 23:01:00 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.271 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Derek S. Ray, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1618,8 +1618,9 @@ struct monst *mon; struct monst **monst_list; /* &migrating_mons or &mydogs or null */ { struct monst *mtmp; - boolean unhide = (monst_list != 0); int mx = mon->mx, my = mon->my; + boolean on_map = (m_at(mx, my) == mon), + unhide = (monst_list != 0); if (!fmon) panic("relmon: no fmon available."); @@ -1633,10 +1634,12 @@ struct monst **monst_list; /* &migrating_mons or &mydogs or null */ seemimic(mon); } - if (mon->wormno) - remove_worm(mon); - else - remove_monster(mx, my); + if (on_map) { + if (mon->wormno) + remove_worm(mon); + else + remove_monster(mx, my); + } if (mon == fmon) { fmon = fmon->nmon; @@ -1652,7 +1655,8 @@ struct monst **monst_list; /* &migrating_mons or &mydogs or null */ } if (unhide) { - newsym(mx, my); + if (on_map) + newsym(mx, my); /* insert into mydogs or migrating_mons */ mon->nmon = *monst_list; *monst_list = mon; @@ -2515,7 +2519,7 @@ struct monst *mtmp; { unstuck(mtmp); mdrop_special_objs(mtmp); - migrate_to_level(mtmp, ledger_no(&u.uz), MIGR_APPROX_XY, NULL); + migrate_to_level(mtmp, ledger_no(&u.uz), MIGR_APPROX_XY, (coord *) 0); } /* make monster mtmp next to you (if possible); @@ -2823,40 +2827,34 @@ boolean via_attack; void wake_nearby() { - register struct monst *mtmp; - - for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) { - if (DEADMONSTER(mtmp)) - continue; - if (distu(mtmp->mx, mtmp->my) < u.ulevel * 20) { - mtmp->msleeping = 0; - if (!unique_corpstat(mtmp->data)) - mtmp->mstrategy &= ~STRAT_WAITMASK; - if (mtmp->mtame) { - if (!mtmp->isminion) - EDOG(mtmp)->whistletime = moves; - /* Clear mtrack. This is to fix up a pet who is - stuck "fleeing" its master. */ - memset(mtmp->mtrack, 0, sizeof(mtmp->mtrack)); - } - } - } + wake_nearto(u.ux, u.uy, u.ulevel * 20); } /* Wake up monsters near some particular location. */ void wake_nearto(x, y, distance) -register int x, y, distance; +int x, y, distance; { - register struct monst *mtmp; + struct monst *mtmp; for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) { if (DEADMONSTER(mtmp)) continue; if (distance == 0 || dist2(mtmp->mx, mtmp->my, x, y) < distance) { - mtmp->msleeping = 0; - if (!unique_corpstat(mtmp->data)) - mtmp->mstrategy &= ~STRAT_WAITMASK; + /* sleep for N turns uses mtmp->mfrozen, but so does paralysis + so we leave mfrozen monsters alone */ + mtmp->msleeping = 0; /* wake indeterminate sleep */ + if (!(mtmp->data->geno & G_UNIQ)) + mtmp->mstrategy &= ~STRAT_WAITMASK; /* wake 'meditation' */ + if (context.mon_moving) + continue; + if (mtmp->mtame) { + if (!mtmp->isminion) + EDOG(mtmp)->whistletime = moves; + /* Clear mtrack. This is to fix up a pet who is + stuck "fleeing" its master. */ + memset(mtmp->mtrack, 0, sizeof mtmp->mtrack); + } } } } diff --git a/src/shk.c b/src/shk.c index 472b1f165..c2895a29f 100644 --- a/src/shk.c +++ b/src/shk.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 shk.c $NHDT-Date: 1515144230 2018/01/05 09:23:50 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.136 $ */ +/* NetHack 3.6 shk.c $NHDT-Date: 1542853899 2018/11/22 02:31:39 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.142 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2400,6 +2400,8 @@ register struct monst *shkp; { register struct obj *otmp; + if (SchroedingersBox(obj)) + return; for (otmp = obj->cobj; otmp; otmp = otmp->nobj) { if (otmp->oclass == COIN_CLASS) continue; @@ -2597,15 +2599,16 @@ char *buf; static const char *const honored[] = { "good", "honored", "most gracious", "esteemed", "most renowned and sacred" }; + Strcat(buf, honored[rn2(SIZE(honored) - 1) + u.uevent.udemigod]); if (is_vampire(youmonst.data)) Strcat(buf, (flags.female) ? " dark lady" : " dark lord"); else if (is_elf(youmonst.data)) Strcat(buf, (flags.female) ? " hiril" : " hir"); else - Strcat(buf, !is_human(youmonst.data) ? " creature" : (flags.female) - ? " lady" - : " sir"); + Strcat(buf, !is_human(youmonst.data) ? " creature" + : (flags.female) ? " lady" + : " sir"); } void diff --git a/src/trap.c b/src/trap.c index da7e01625..d43117e43 100644 --- a/src/trap.c +++ b/src/trap.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 trap.c $NHDT-Date: 1542765365 2018/11/21 01:56:05 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.303 $ */ +/* NetHack 3.6 trap.c $NHDT-Date: 1543100476 2018/11/24 23:01:16 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.311 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */ /* NetHack may be freely redistributed. See license for details. */ @@ -3164,7 +3164,7 @@ domagictrap() if (fate < 10) { /* Most of the time, it creates some monsters. */ - register int cnt = rnd(4); + int cnt = rnd(4); /* blindness effects */ if (!resists_blnd(&youmonst)) { @@ -3189,6 +3189,9 @@ domagictrap() } while (cnt--) (void) makemon((struct permonst *) 0, u.ux, u.uy, NO_MM_FLAGS); + /* roar: wake monsters in vicinity, after placing trap-created ones */ + wake_nearto(u.ux, u.uy, 7 * 7); + /* [flash: should probably also hit nearby gremlins with light] */ } else switch (fate) { case 10: @@ -4038,7 +4041,7 @@ boolean force_failure; } } /* untrappable traps are located on the ground. */ - if (!can_reach_floor(TRUE)) { + if (!can_reach_floor(under_u)) { if (u.usteed && P_SKILL(P_RIDING) < P_BASIC) rider_cant_reach(); else diff --git a/src/vault.c b/src/vault.c index 1947aa75b..7e47577e2 100644 --- a/src/vault.c +++ b/src/vault.c @@ -585,10 +585,10 @@ gd_mv_monaway(grd, nx,ny) register struct monst *grd; int nx,ny; { - if (MON_AT(nx, ny) && nx != grd->mx && ny != grd->my) { + if (MON_AT(nx, ny) && !(nx == grd->mx && ny == grd->my)) { if (!Deaf) verbalize("Out of my way, scum!"); - if (!rloc(m_at(nx, ny), FALSE) || m_at(nx, ny)) + if (!rloc(m_at(nx, ny), FALSE) || MON_AT(nx, ny)) m_into_limbo(m_at(nx, ny)); } } diff --git a/sys/unix/hints/linux b/sys/unix/hints/linux index cb0317946..1d9c45509 100644 --- a/sys/unix/hints/linux +++ b/sys/unix/hints/linux @@ -28,6 +28,12 @@ CFLAGS+=-DHACKDIR=\"$(HACKDIR)\" CFLAGS+=-DDUMPLOG CFLAGS+=-DCONFIG_ERROR_SECURE=FALSE CFLAGS+=-DCURSES_GRAPHICS +#CFLAGS+=-DEXTRA_SANITY_CHECKS +#CFLAGS+=-DEDIT_GETLIN +#CFLAGS+=-DSCORE_ON_BOTL +#CFLAGS+=-DMSGHANDLER +#CFLAGS+=-DTTY_TILES_ESCCODES +#CFLAGS+=-DDLB LINK=$(CC) # Only needed for GLIBC stack trace: @@ -37,6 +43,10 @@ WINSRC = $(WINTTYSRC) $(WINCURSESSRC) WINOBJ = $(WINTTYOBJ) $(WINCURSESOBJ) WINLIB = $(WINTTYLIB) $(WINCURSESLIB) +# if TTY_TILES_ESCCODES +#WINSRC += tile.c +#WINOBJ += tile.o + WINTTYLIB=-lcurses CHOWN=true diff --git a/sys/unix/hints/linux-minimal b/sys/unix/hints/linux-minimal new file mode 100644 index 000000000..6c2638ae3 --- /dev/null +++ b/sys/unix/hints/linux-minimal @@ -0,0 +1,31 @@ +# +# NetHack 3.6 linux $NHDT-Date: 1432512814 2018/11/23 16:00:00 $ $NHDT-Branch: master $:$NHDT-Revision: 1.12 $ +# Copyright (c) Patric Mueller +# NetHack may be freely redistributed. See license for details. +# +#-PRE +# Hints file for a minimal build +# This hints file provides the base for a minimal tty build for Linux + +PREFIX=$(wildcard ~)/nethack-minimal +HACKDIR=$(PREFIX)/games/lib/$(GAME)dir +SHELLDIR=$(PREFIX)/games +INSTDIR=$(HACKDIR) +VARDIR=$(HACKDIR) + +CFLAGS=-g -I../include + +LINK=$(CC) + +WINSRC = $(WINTTYSRC) +WINOBJ = $(WINTTYOBJ) +WINLIB = $(WINTTYLIB) + +WINTTYLIB=-lcurses + +CHOWN=true +CHGRP=true + +VARDIRPERM = 0755 +VARFILEPERM = 0600 +GAMEPERM = 0755 diff --git a/sys/winnt/Makefile.msc b/sys/winnt/Makefile.msc index 926eed8ad..3f2c76fd5 100644 --- a/sys/winnt/Makefile.msc +++ b/sys/winnt/Makefile.msc @@ -686,7 +686,8 @@ $(O)install.tag: $(DAT)\data $(DAT)\rumors $(DAT)\dungeon \ if exist $(DOC)\nethack.txt copy $(DOC)\nethack.txt $(GAMEDIR)\NetHack.txt @if exist $(GAMEDIR)\NetHack.PDB echo NOTE: You may want to remove $(GAMEDIR:\=/)/NetHack.PDB to conserve space @if exist $(GAMEDIR)\NetHackW.PDB echo NOTE: You may want to remove $(GAMEDIR:\=/)/NetHackW.PDB to conserve space - -if not exist $(GAMEDIR)\defaults.nh copy $(MSWSYS)\defaults.nh $(GAMEDIR)\defaults.nh + $(U)makedefs -c + -if not exist $(GAMEDIR)\defaults.nh copy fixed_defaults.nh $(GAMEDIR)\defaults.nh -if not exist $(GAMEDIR)\record. goto>$(GAMEDIR)\record. echo install done > $@ @@ -1359,6 +1360,7 @@ clean: if exist $(U)dgncomp.exe del $(U)dgncomp.exe if exist $(SRC)\*.lnk del $(SRC)\*.lnk if exist $(SRC)\*.map del $(SRC)\*.map + if exist $(SRC)\fixed_defaults.nh del $(SRC)\fixed_defaults.nh if exist $(O)install.tag del $(O)install.tag if exist $(O)console.res del $(O)console.res if exist $(O)dgncomp.MAP del $(O)dgncomp.MAP diff --git a/util/makedefs.c b/util/makedefs.c index 0b97a8bcb..29a528f01 100644 --- a/util/makedefs.c +++ b/util/makedefs.c @@ -111,6 +111,15 @@ static const char SCCS_Id[] UNUSED = "@(#)makedefs.c\t3.6\t2018/03/02"; #endif /* else !MAC */ #endif /* else !AMIGA */ +#if !defined(STATUS_HILITES) && defined(WIN32) +#define FIX_SAMPLECONFIG +#endif + +#ifdef WIN32 +#define SAMPLE_CONFIGFILE "../sys/winnt/defaults.nh" +#define FIXED_CONFIGFILE "./fixed_defaults.nh" +#endif + static const char *Dont_Edit_Code = "/* This source file is generated by 'makedefs'. Do not edit. */\n", @@ -162,6 +171,9 @@ void NDECL(do_questtxt); void NDECL(do_rumors); void NDECL(do_oracles); void NDECL(do_vision); +#ifdef WIN32 +void NDECL(do_fix_sampleconfig); +#endif extern void NDECL(monst_init); /* monst.c */ extern void NDECL(objects_init); /* objects.c */ @@ -364,7 +376,12 @@ char *options; case 'Z': do_vision(); break; - +#ifdef WIN32 + case 'c': + case 'C': + do_fix_sampleconfig(); + break; +#endif default: Fprintf(stderr, "Unknown option '%c'.\n", *options); (void) fflush(stderr); @@ -1457,6 +1474,45 @@ char *githash, *gitbranch; return FALSE; } +#ifdef WIN32 +void +do_fix_sampleconfig() +{ + FILE *scfp, *ofcfp; + char fixedline[600]; + char *line; + + if (!(scfp = fopen(SAMPLE_CONFIGFILE, RDTMODE))) { + return; + } + if (!(ofcfp = fopen(FIXED_CONFIGFILE, WRTMODE))) { + return; + } + + /* read the sample config file */ + while ((line = fgetline(scfp)) != 0) { + /* comment out the STATUS_HILITES related lines */ + if (strlen(line) < (600 - 1)) { + if (strstr(line, "statushilites") || strstr(line, "hilite_status:")) { +#ifdef FIX_SAMPLECONFIG + fixedline[0] = '#'; + Strcpy(&fixedline[1], line); +#else + Strcpy(fixedline, line); +#endif + fputs(fixedline, ofcfp); + } else { + fputs(line, ofcfp); + } + } + free(line); + } + Fclose(scfp); + Fclose(ofcfp); + return; +} +#endif /* WIN32 */ + static int case_insensitive_comp(s1, s2) const char *s1; diff --git a/win/tty/wintty.c b/win/tty/wintty.c index d5cac96c3..47bac195b 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -3612,26 +3612,10 @@ const char *fmt; boolean enable; { genl_status_enablefield(fieldidx, nm, fmt, enable); +#ifdef STATUS_HILITES /* force re-evaluation of last field on the row */ setlast = FALSE; -} - -void -do_setlast() -{ - int i, row, fld; - - setlast = TRUE; - for (row = 0; row < 2; ++row) - for (i = MAX_PER_ROW - 1; i > 0; --i) { - fld = fieldorder[row][i]; - - if (fld == BL_FLUSH || !status_activefields[fld]) - continue; - - last_on_row[row] = fld; - break; - } +#endif } #ifdef STATUS_HILITES @@ -3807,6 +3791,24 @@ unsigned long *colormasks; return; } +void +do_setlast() +{ + int i, row, fld; + + setlast = TRUE; + for (row = 0; row < 2; ++row) + for (i = MAX_PER_ROW - 1; i > 0; --i) { + fld = fieldorder[row][i]; + + if (fld == BL_FLUSH || !status_activefields[fld]) + continue; + + last_on_row[row] = fld; + break; + } +} + STATIC_OVL int make_things_fit(force_update) boolean force_update;