Merge branch 'master' into win32-x64-working

This commit is contained in:
nhmall
2015-06-15 16:49:31 -04:00
4 changed files with 95 additions and 41 deletions
+9 -9
View File
@@ -77,8 +77,8 @@ a small, leatherbound book which he handed to War, who was hammering the
table with a mailed fist. table with a mailed fist.
'It's "Nosehinger on the Laws of Contract",' he said. 'It's quite good, 'It's "Nosehinger on the Laws of Contract",' he said. 'It's quite good,
there's a lot in it about double finessing and how to -' there's a lot in it about double finessing and how to -'
Death snatched the book with a bony hand anflipped through the pages, quite Death snatched the book with a bony hand and flipped through the pages,
oblivious to the presence of the two men. quite oblivious to the presence of the two men.
'RIGHT,' he said, 'PESTILENCE, OPEN ANOTHER PACK OF CARDS. I'M GOING TO GET 'RIGHT,' he said, 'PESTILENCE, OPEN ANOTHER PACK OF CARDS. I'M GOING TO GET
TO THE BOTTOM OF THIS IF IT KILLS ME. FIGURATIVELY SPEAKING OF COURSE.' TO THE BOTTOM OF THIS IF IT KILLS ME. FIGURATIVELY SPEAKING OF COURSE.'
@@ -242,7 +242,7 @@ No enemies had ever taken Ankh-Morpork. Well, /technically/ they had, quite
own horses any more, and within a couple of months they were just another own horses any more, and within a couple of months they were just another
minority group with its own graffiti and food shops. minority group with its own graffiti and food shops.
[Terry Pratchett, Eric] [Eric, by Terry Pratchett]
%e passage %e passage
%passage 2 %passage 2
Rincewind looked down at the broad steps they were climbing. They were Rincewind looked down at the broad steps they were climbing. They were
@@ -254,7 +254,7 @@ Eric was standing on: For The Sake Of The Children.
'I think they're meant to be good intentions,' said Rincewind. This was a 'I think they're meant to be good intentions,' said Rincewind. This was a
road to hell, and demons were, after all, traditionalists. road to hell, and demons were, after all, traditionalists.
[Terry Pratchett, Eric] [Eric, by Terry Pratchett]
%e passage %e passage
%e title %e title
# #
@@ -267,13 +267,13 @@ This is space. It's sometimes called the final frontier.
be nothing for it to be a frontier /to/, but as frontiers go, it's pretty be nothing for it to be a frontier /to/, but as frontiers go, it's pretty
penultimate...) penultimate...)
[Terry Pratchett, Moving Pictures] [Moving Pictures, by Terry Pratchett]
%e passage %e passage
%passage 2 %passage 2
By and large, the only skill the alchemists of Ankh-Morpork had discovered By and large, the only skill the alchemists of Ankh-Morpork had discovered
so far was the ability to turn gold into less gold. so far was the ability to turn gold into less gold.
[Terry Pratchett, Moving Pictures] [Moving Pictures, by Terry Pratchett]
%e passage %e passage
%passage 3 %passage 3
There was a dog sitting by his feet. There was a dog sitting by his feet.
@@ -286,14 +286,14 @@ said 'Woof?' Victor poked an exploratory finger in his ear. It must have
and 'hwhoouf!'. No, it was that it hadn't in fact /barked/ at all. It had and 'hwhoouf!'. No, it was that it hadn't in fact /barked/ at all. It had
/said/ 'woof'. 'Could have bin worse, mister. I could have said "miaow".' /said/ 'woof'. 'Could have bin worse, mister. I could have said "miaow".'
[Terry Pratchett, Moving Pictures] [Moving Pictures, by Terry Pratchett]
%e passage %e passage
%passage 4 %passage 4
''Twas beauty killed the beast,' said the Dean, who liked to say things ''Twas beauty killed the beast,' said the Dean, who liked to say things
like that. 'No it wasn't,' said the Chair. 'It was it splatting into the like that. 'No it wasn't,' said the Chair. 'It was it splatting into the
ground like that.' ground like that.'
[Terry Pratchett, Moving Pictures] [Moving Pictures, by Terry Pratchett]
%e passage %e passage
%e title %e title
# #
@@ -692,7 +692,7 @@ glass is half full. And then there are those who say: this glass is half
empty. empty.
The world belongs, however, to those who can look at the glass and say: The world belongs, however, to those who can look at the glass and say:
What's up with this glass? Excuse me? Excuse me? This is may glass? I What's up with this glass? Excuse me? Excuse me? This is my glass? I
don't think so. My glass was full! And it was a bigger glass! Who's been don't think so. My glass was full! And it was a bigger glass! Who's been
pinching my beer? pinching my beer?
+2 -1
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 extern.h $NHDT-Date: 1433207912 2015/06/02 01:18:32 $ $NHDT-Branch: master $:$NHDT-Revision: 1.500 $ */ /* NetHack 3.6 extern.h $NHDT-Date: 1434330826 2015/06/15 01:13:46 $ $NHDT-Branch: master $:$NHDT-Revision: 1.503 $ */
/* Copyright (c) Steve Creps, 1988. */ /* Copyright (c) Steve Creps, 1988. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -537,6 +537,7 @@ E void NDECL(init_dungeons);
E s_level *FDECL(find_level, (const char *)); E s_level *FDECL(find_level, (const char *));
E s_level *FDECL(Is_special, (d_level *)); E s_level *FDECL(Is_special, (d_level *));
E branch *FDECL(Is_branchlev, (d_level *)); E branch *FDECL(Is_branchlev, (d_level *));
E boolean FDECL(builds_up, (d_level *));
E xchar FDECL(ledger_no, (d_level *)); E xchar FDECL(ledger_no, (d_level *));
E xchar NDECL(maxledgerno); E xchar NDECL(maxledgerno);
E schar FDECL(depth, (d_level *)); E schar FDECL(depth, (d_level *));
+9 -3
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 do.c $NHDT-Date: 1432512769 2015/05/25 00:12:49 $ $NHDT-Branch: master $:$NHDT-Revision: 1.142 $ */ /* NetHack 3.6 do.c $NHDT-Date: 1434330833 2015/06/15 01:13:53 $ $NHDT-Branch: master $:$NHDT-Revision: 1.144 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1224,8 +1224,14 @@ boolean at_stairs, falling, portal;
assign_level(&u.uz, newlevel); assign_level(&u.uz, newlevel);
assign_level(&u.utolev, newlevel); assign_level(&u.utolev, newlevel);
u.utotype = 0; u.utotype = 0;
if (dunlev_reached(&u.uz) < dunlev(&u.uz)) if (!builds_up(&u.uz)) { /* usual case */
dunlev_reached(&u.uz) = dunlev(&u.uz); if (dunlev(&u.uz) > dunlev_reached(&u.uz))
dunlev_reached(&u.uz) = dunlev(&u.uz);
} else {
if (dunlev_reached(&u.uz) == 0
|| dunlev(&u.uz) < dunlev_reached(&u.uz))
dunlev_reached(&u.uz) = dunlev(&u.uz);
}
reset_rndmonst(NON_PM); /* u.uz change affects monster generation */ reset_rndmonst(NON_PM); /* u.uz change affects monster generation */
/* set default level change destination areas */ /* set default level change destination areas */
+75 -28
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 dungeon.c $NHDT-Date: 1432512766 2015/05/25 00:12:46 $ $NHDT-Branch: master $:$NHDT-Revision: 1.58 $ */ /* NetHack 3.6 dungeon.c $NHDT-Date: 1434330836 2015/06/15 01:13:56 $ $NHDT-Branch: master $:$NHDT-Revision: 1.59 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1067,8 +1067,7 @@ xchar
ledger_to_dlev(ledgerno) ledger_to_dlev(ledgerno)
xchar ledgerno; xchar ledgerno;
{ {
return ( return (xchar)(ledgerno - dungeons[ledger_to_dnum(ledgerno)].ledger_start);
(xchar)(ledgerno - dungeons[ledger_to_dnum(ledgerno)].ledger_start));
} }
/* returns the depth of a level, in floors below the surface */ /* returns the depth of a level, in floors below the surface */
@@ -1077,14 +1076,16 @@ schar
depth(lev) depth(lev)
d_level *lev; d_level *lev;
{ {
return ((schar)(dungeons[lev->dnum].depth_start + lev->dlevel - 1)); return (schar) (dungeons[lev->dnum].depth_start + lev->dlevel - 1);
} }
boolean on_level(lev1, lev2) /* are "lev1" and "lev2" actually the same? */ /* are "lev1" and "lev2" actually the same? */
boolean
on_level(lev1, lev2)
d_level *lev1, *lev2; d_level *lev1, *lev2;
{ {
return ((boolean)((lev1->dnum == lev2->dnum) return (boolean) ((lev1->dnum == lev2->dnum)
&& (lev1->dlevel == lev2->dlevel))); && (lev1->dlevel == lev2->dlevel));
} }
/* is this level referenced in the special level chain? */ /* is this level referenced in the special level chain? */
@@ -1098,7 +1099,7 @@ d_level *lev;
if (on_level(lev, &levtmp->dlevel)) if (on_level(lev, &levtmp->dlevel))
return (levtmp); return (levtmp);
return ((s_level *) 0); return (s_level *) 0;
} }
/* /*
@@ -1118,6 +1119,20 @@ d_level *lev;
return (branch *) 0; return (branch *) 0;
} }
/* returns True iff the branch 'lev' is in a branch which builds up */
boolean
builds_up(lev)
d_level *lev;
{
dungeon *dptr = &dungeons[lev->dnum];
/*
* FIXME: this misclassifies a single level branch reached via stairs
* from below. Saving grace is that no such branches currently exist.
*/
return (boolean) (dptr->num_dunlevs > 1
&& dptr->entry_lev == dptr->num_dunlevs);
}
/* goto the next level (or appropriate dungeon) */ /* goto the next level (or appropriate dungeon) */
void void
next_level(at_stairs) next_level(at_stairs)
@@ -1523,12 +1538,39 @@ d_level *lev;
xchar xchar
level_difficulty() level_difficulty()
{ {
if (In_endgame(&u.uz)) int res;
return ((xchar)(depth(&sanctum_level) + u.ulevel / 2));
else if (u.uhave.amulet) if (In_endgame(&u.uz)) {
return (deepest_lev_reached(FALSE)); res = depth(&sanctum_level) + u.ulevel / 2;
else } else if (u.uhave.amulet) {
return ((xchar) depth(&u.uz)); res = deepest_lev_reached(FALSE);
} else {
res = depth(&u.uz);
/* depth() is the number of elevation units (levels) below
the theorhetical surface; in a builds-up branch, that value
ends up making the harder to reach levels be treated as if
they were easier; adjust for the extra effort involved in
going down to the entrance and then up to the location */
if (builds_up(&u.uz))
res += 2 * (dungeons[u.uz.dnum].entry_lev - u.uz.dlevel + 1);
/*
* 'Proof' by example: suppose the entrance to sokoban is
* on dungeon level 9, leading up to bottom sokoban level
* of 8 [entry_lev]. When the hero is on sokoban level 8
* [uz.dlevel], depth() yields eight but he has ventured
* one level beyond 9, so difficulty depth should be 10:
* 8 + 2 * (8 - 8 + 1) => 10.
* Going up to 7, depth is 7 but hero will be two beyond 9:
* 7 + 2 * (8 - 7 + 1) => 11.
* When he goes up to level 6, three levels beyond 9:
* 6 + 2 * (8 - 6 + 1) => 12.
* And the top level of sokoban at 5, four levels beyond 9:
* 5 + 2 * (8 - 5 + 1) => 13.
* The same applies to Vlad's Tower, although the increment
* there is inconsequential compared to overall depth.
*/
}
return (xchar) res;
} }
/* Take one word and try to match it to a level. /* Take one word and try to match it to a level.
@@ -2143,10 +2185,12 @@ mapseen *mptr;
if (In_endgame(&u.uz)) if (In_endgame(&u.uz))
return In_endgame(&mptr->lev); return In_endgame(&mptr->lev);
/* level is of interest if it has non-zero feature count or known bones /* level is of interest if it has non-zero feature count or known bones
or user annotation or known connection to another dungeon brancth */ or user annotation or known connection to another dungeon branch
or is the furthest level reached in its branch */
return (INTEREST(mptr->feat) || (mptr->final_resting_place return (INTEREST(mptr->feat) || (mptr->final_resting_place
&& (mptr->flags.knownbones || wizard)) && (mptr->flags.knownbones || wizard))
|| mptr->custom || mptr->br); || mptr->custom || mptr->br
|| mptr->lev.dlevel == dungeons[mptr->lev.dnum].dunlev_ureached);
} }
/* recalculate mapseen for the current level */ /* recalculate mapseen for the current level */
@@ -2634,30 +2678,33 @@ int how; /* cause of death; only used if final==2 and mptr->lev==u.uz */
boolean printdun; boolean printdun;
{ {
char buf[BUFSZ], tmpbuf[BUFSZ]; char buf[BUFSZ], tmpbuf[BUFSZ];
int i, depthstart; int i, depthstart, dnum;
boolean died_here = (final == 2 && on_level(&u.uz, &mptr->lev)); boolean died_here = (final == 2 && on_level(&u.uz, &mptr->lev));
/* Damnable special cases */ /* Damnable special cases */
/* The quest and knox should appear to be level 1 to match /* The quest and knox should appear to be level 1 to match
* other text. * other text.
*/ */
if (mptr->lev.dnum == quest_dnum || mptr->lev.dnum == knox_level.dnum) dnum = mptr->lev.dnum;
if (dnum == quest_dnum || dnum == knox_level.dnum)
depthstart = 1; depthstart = 1;
else else
depthstart = dungeons[mptr->lev.dnum].depth_start; depthstart = dungeons[dnum].depth_start;
if (printdun) { if (printdun) {
/* Sokoban lies about dunlev_ureached and we should if (dungeons[dnum].dunlev_ureached == dungeons[dnum].entry_lev
* suppress the negative numbers in the endgame. /* suppress the negative numbers in the endgame */
*/ || In_endgame(&mptr->lev))
if (dungeons[mptr->lev.dnum].dunlev_ureached == 1 Sprintf(buf, "%s:", dungeons[dnum].dname);
|| mptr->lev.dnum == sokoban_dnum || In_endgame(&mptr->lev)) else if (builds_up(&mptr->lev))
Sprintf(buf, "%s:", dungeons[mptr->lev.dnum].dname); Sprintf(buf, "%s: levels %d up to %d",
dungeons[dnum].dname,
depthstart + dungeons[dnum].entry_lev - 1,
depthstart + dungeons[dnum].dunlev_ureached - 1);
else else
Sprintf(buf, "%s: levels %d to %d", Sprintf(buf, "%s: levels %d to %d",
dungeons[mptr->lev.dnum].dname, depthstart, dungeons[dnum].dname, depthstart,
depthstart + dungeons[mptr->lev.dnum].dunlev_ureached depthstart + dungeons[dnum].dunlev_ureached - 1);
- 1);
putstr(win, !final ? ATR_INVERSE : 0, buf); putstr(win, !final ? ATR_INVERSE : 0, buf);
} }