Skip to content

Commit 68ccdb9

Browse files
Merge remote-tracking branch 'upstream/master'
2 parents 3f70c0f + 19e538f commit 68ccdb9

File tree

20 files changed

+92
-75
lines changed

20 files changed

+92
-75
lines changed

aimake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,8 @@ handling (to place the files in the right place).
299299

300300
=item LEXFLAGS
301301

302-
Command-line arguments to pass to C<lex>. The default is to pass C<--warn>,
303-
which tells C<flex> (the default C<lex> implementation) to produce warnings.
302+
Command-line arguments to pass to C<lex>. The default is an empty set of
303+
options.
304304

305305
=back
306306

@@ -10820,7 +10820,7 @@ EOF
1082010820

1082110821
default_lexflags => {
1082210822
output => 'optionset:LEXFLAGS',
10823-
outdepends => ['optstring:--warn'],
10823+
outdepends => [],
1082410824
verb => 'determined',
1082510825
low_message_priority => 1,
1082610826
command_line_override => 'LEXFLAGS',

libnethack/dat/history

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
NetHack History file for release 4.3.0-beta3
2-
This file was last updated by Alex Smith, 2015-04-01
2+
This file was last updated by Alex Smith, 2017-09-01
33

44
Behold, mortal, the origins of NetHack...
55

@@ -270,8 +270,7 @@ The NetHack 4 distribution also contains contributions from:
270270
Edoardo Spadolini Nathan Eady Tim Visher
271271
Eric S. Raymond Nephi Trevor Cook
272272
Fredrik Ljungdahl Pasi Kallinnen Tung Nguyen
273-
GreyKnight Patric Müller Wan-ichi
274-
Grunt Paul Pliska Zmy
275-
Haruko Numata Paula Breton Zsbán Ambrus
276-
Hojita Discordia quuxplusone
277-
273+
GreyKnight Patric Müller Vincent Ho
274+
Grunt Paul Pliska Wan-ichi
275+
Haruko Numata Paula Breton Zmy
276+
Hojita Discordia quuxplusone Zsbán Ambrus

libnethack/include/extern.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* vim:set cin ft=c sw=4 sts=4 ts=8 et ai cino=Ls\:0t0(0 : -*- mode:c;fill-column:80;tab-width:8;c-basic-offset:4;indent-tabs-mode:nil;c-file-style:"k&r" -*-*/
2-
/* Last modified by Alex Smith, 2015-07-22 */
2+
/* Last modified by Alex Smith, 2017-06-29 */
33
/* Copyright (c) Steve Creps, 1988. */
44
/* NetHack may be freely redistributed. See license for details. */
55

@@ -646,7 +646,8 @@ extern void lookaround(enum u_interaction_mode);
646646
extern int monster_nearby(void);
647647
extern void losehp(int, const char *);
648648
extern int weight_cap(void);
649-
extern int inv_weight(void);
649+
extern int inv_weight_over_cap(void);
650+
extern int inv_weight_total(void);
650651
extern int near_capacity(void);
651652
extern int calc_capacity(int);
652653
extern int max_capacity(void);

libnethack/include/permonst.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* vim:set cin ft=c sw=4 sts=4 ts=8 et ai cino=Ls\:0t0(0 : -*- mode:c;fill-column:80;tab-width:8;c-basic-offset:4;indent-tabs-mode:nil;c-file-style:"k&r" -*-*/
2-
/* Last modified by Alex Smith, 2014-04-05 */
2+
/* Last modified by Alex Smith, 2017-07-15 */
33
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
44
/* NetHack may be freely redistributed. See license for details. */
55

@@ -81,7 +81,7 @@ extern const struct permonst mons[]; /* the master list of monster types */
8181
# define FAST_SPEED 15
8282
# define VERY_FAST 24
8383

84-
# define NON_PM PM_PLAYERMON /* "not a monster" */
84+
# define NON_PM (-1) /* "not a monster" */
8585
# define LOW_PM (NON_PM+1) /* first monster in mons[] */
8686
# define SPECIAL_PM PM_LONG_WORM_TAIL /* [normal] < ~ < [special] */
8787
/* mons[SPECIAL_PM] through mons[NUMMONS-1], inclusive, are never

libnethack/src/cmd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* vim:set cin ft=c sw=4 sts=4 ts=8 et ai cino=Ls\:0t0(0 : -*- mode:c;fill-column:80;tab-width:8;c-basic-offset:4;indent-tabs-mode:nil;c-file-style:"k&r" -*-*/
2-
/* Last modified by Alex Smith, 2015-10-11 */
2+
/* Last modified by Alex Smith, 2017-07-15 */
33
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
44
/* NetHack may be freely redistributed. See license for details. */
55

@@ -868,7 +868,7 @@ doattributes(const struct nh_cmd_arg *arg)
868868
add_menutext(&menu, buf);
869869

870870
wc = weight_cap();
871-
buf = msgprintf("%-10s: %ld (", "burden", wc + inv_weight());
871+
buf = msgprintf("%-10s: %d (", "burden", inv_weight_total());
872872

873873
switch (calc_capacity(wc / 4)) {
874874
case UNENCUMBERED:

libnethack/src/do.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* vim:set cin ft=c sw=4 sts=4 ts=8 et ai cino=Ls\:0t0(0 : -*- mode:c;fill-column:80;tab-width:8;c-basic-offset:4;indent-tabs-mode:nil;c-file-style:"k&r" -*-*/
2-
/* Last modified by Alex Smith, 2015-07-20 */
2+
/* Last modified by Alex Smith, 2017-06-29 */
33
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
44
/* NetHack may be freely redistributed. See license for details. */
55

@@ -827,7 +827,7 @@ doup(void)
827827
return 1;
828828
}
829829
if (near_capacity() > SLT_ENCUMBER) {
830-
/* No levitation check; inv_weight() already allows for it */
830+
/* No levitation check; the weight check already allows for it */
831831
pline("Your load is too heavy to climb the %s.",
832832
level->locations[u.ux][u.uy].typ == STAIRS ? "stairs" : "ladder");
833833
return 1;

libnethack/src/dokick.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* vim:set cin ft=c sw=4 sts=4 ts=8 et ai cino=Ls\:0t0(0 : -*- mode:c;fill-column:80;tab-width:8;c-basic-offset:4;indent-tabs-mode:nil;c-file-style:"k&r" -*-*/
2-
/* Last modified by Alex Smith, 2015-07-12 */
2+
/* Last modified by Alex Smith, 2017-06-29 */
33
/* Copyright (c) Izchak Miller, Mike Stephenson, Steve Linhart, 1989. */
44
/* NetHack may be freely redistributed. See license for details. */
55

@@ -200,7 +200,7 @@ kick_monster(xchar x, xchar y, schar dx, schar dy)
200200
return attack_status;
201201
}
202202

203-
i = -inv_weight();
203+
i = -inv_weight_over_cap();
204204
j = weight_cap();
205205

206206
if (i < (j * 3) / 10) {
@@ -800,7 +800,7 @@ dokick(const struct nh_cmd_arg *arg)
800800
if (Is_airlevel(&u.uz) || Levitation) {
801801
int range;
802802

803-
range = ((int)youmonst.data->cwt + (weight_cap() + inv_weight()));
803+
range = ((int)youmonst.data->cwt + inv_weight_total());
804804
if (range < 1)
805805
range = 1; /* divide by zero avoidance */
806806
range = (3 * (int)mdat->cwt) / range;

libnethack/src/dothrow.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* vim:set cin ft=c sw=4 sts=4 ts=8 et ai cino=Ls\:0t0(0 : -*- mode:c;fill-column:80;tab-width:8;c-basic-offset:4;indent-tabs-mode:nil;c-file-style:"k&r" -*-*/
2-
/* Last modified by Alex Smith, 2015-05-19 */
2+
/* Last modified by Alex Smith, 2017-06-29 */
33
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
44
/* NetHack may be freely redistributed. See license for details. */
55

@@ -474,7 +474,7 @@ hurtle_step(void *arg, int x, int y)
474474
}
475475
if ((u.ux - x) && (u.uy - y) && bad_rock(youmonst.data, u.ux, y) &&
476476
bad_rock(youmonst.data, x, u.uy)) {
477-
boolean too_much = (invent && (inv_weight() + weight_cap() > 600));
477+
boolean too_much = (invent && (inv_weight_total() > 600));
478478

479479
/* Move at a diagonal. */
480480
if (bigmonst(youmonst.data) || too_much) {

libnethack/src/files.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/* vim:set cin ft=c sw=4 sts=4 ts=8 et ai cino=Ls\:0t0(0 : -*- mode:c;fill-column:80;tab-width:8;c-basic-offset:4;indent-tabs-mode:nil;c-file-style:"k&r" -*-*/
2-
/* Last modified by Alex Smith, 2015-07-11 */
2+
/* Last modified by Alex Smith, 2017-09-01 */
33
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
44
/* NetHack may be freely redistributed. See license for details. */
55

66
#if defined(AIMAKE_BUILDOS_MSWin32)
77
# define WIN32_LEAN_AND_MEAN
8-
# include <Windows.h> /* must be before compilers.h */
8+
# include <windows.h> /* must be before compilers.h */
99

1010
# if !defined(S_IRUSR)
1111
# define S_IRUSR _S_IREAD

libnethack/src/hack.c

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* vim:set cin ft=c sw=4 sts=4 ts=8 et ai cino=Ls\:0t0(0 : -*- mode:c;fill-column:80;tab-width:8;c-basic-offset:4;indent-tabs-mode:nil;c-file-style:"k&r" -*-*/
2-
/* Last modified by Fredrik Ljungdahl, 2015-10-02 */
2+
/* Last modified by Alex Smith, 2017-06-29 */
33
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
44
/* NetHack may be freely redistributed. See license for details. */
55

@@ -859,7 +859,7 @@ test_move(int ux, int uy, int dx, int dy, int dz, int mode,
859859
pline("Your body is too large to fit through.");
860860
return FALSE;
861861
}
862-
if (invent && (inv_weight() + weight_cap() > 600)) {
862+
if (invent && (inv_weight_total() > 600)) {
863863
if (mode == DO_MOVE)
864864
pline("You are carrying too much to get through.");
865865
return FALSE;
@@ -905,7 +905,7 @@ test_move(int ux, int uy, int dx, int dy, int dz, int mode,
905905
/* Can we be blocked by a boulder? */
906906
if (!throws_rocks(youmonst.data) &&
907907
!(verysmall(youmonst.data) && !u.usteed) &&
908-
!((!invent || inv_weight() <= -850) && !u.usteed)) {
908+
!((!invent || inv_weight_over_cap() <= -850) && !u.usteed)) {
909909
/* We assume we can move boulders when we're at a distance from them.
910910
When it comes to actually do the move, resolve_uim() may replace the
911911
move with a #pushboulder command. If it doesn't, the move fails
@@ -3099,12 +3099,8 @@ weight_cap(void)
30993099
return (int)carrcap;
31003100
}
31013101

3102-
static int wc; /* current weight_cap(); valid after call to inv_weight() */
3103-
3104-
/* returns how far beyond the normal capacity the player is currently. */
3105-
/* inv_weight() is negative if the player is below normal capacity. */
31063102
int
3107-
inv_weight(void)
3103+
inv_weight_total(void)
31083104
{
31093105
struct obj *otmp = invent;
31103106
int wt = 0;
@@ -3116,18 +3112,27 @@ inv_weight(void)
31163112
wt += otmp->owt;
31173113
otmp = otmp->nobj;
31183114
}
3119-
wc = weight_cap();
3120-
return wt - wc;
3115+
return wt;
3116+
}
3117+
3118+
/* Returns how far beyond the normal capacity the player is currently. Negative
3119+
if the player is below normal capacity. */
3120+
int
3121+
inv_weight_over_cap(void)
3122+
{
3123+
return inv_weight_total() - weight_cap();
31213124
}
31223125

3126+
31233127
/*
31243128
* Returns 0 if below normal capacity, or the number of "capacity units"
31253129
* over the normal capacity the player is loaded. Max is 5.
31263130
*/
31273131
int
31283132
calc_capacity(int xtra_wt)
31293133
{
3130-
int cap, wt = inv_weight() + xtra_wt;
3134+
int wc = weight_cap();
3135+
int cap, wt = inv_weight_total() + xtra_wt - wc;
31313136

31323137
if (wt <= 0)
31333138
return UNENCUMBERED;
@@ -3146,9 +3151,9 @@ near_capacity(void)
31463151
int
31473152
max_capacity(void)
31483153
{
3149-
int wt = inv_weight();
3154+
int wt = inv_weight_over_cap();
31503155

3151-
return wt - (2 * wc);
3156+
return wt - (2 * weight_cap());
31523157
}
31533158

31543159
boolean

0 commit comments

Comments
 (0)