Commit Graph

12262 Commits

Author SHA1 Message Date
PatR
ecee4e8610 Guidebook tweaks for ^E, section 5 header
Describe #wizdetect as revealing hidden things rather than searching
for hidden things since the latter is described more than once as
possibly needing multiple tries.

For plain text output, the "Rooms and corridors" section header was
harder than necessary to notice because it seemed to run together
with the list of commands preceding it.
|
| u    #untrap
|
| 5.  Rooms and corridors
|
Inserting an extra blank line in between them is helpful.  That isn't
needed for Postscript/PDF output because the text of the section
title is rendered with bold font, but I didn't attempt to make the
extra line be conditional.  The 'roff directive is added as a comment
to the TeX source without knowing whether an extra blank line would
be useful there (doubtful).
2021-08-26 15:32:52 -07:00
Pasi Kallinen
2aaee76c5c Fix ball bypass sanity complaint
Be punished, get swallowed, drop the ball inside the monster
via the 'D' drop, kill the swallower - this issued a sanity
check complaint about the ball bypass flag.

In this case, the ball was "floating", not on any object chain,
when dropped inside the monster, so clear_bypasses didn't
clear the flag.
2021-08-26 18:46:25 +03:00
Pasi Kallinen
2f94ad489f Reindent main loop
No code change, just reindenting the main loop, as it wasn't
reindented when the inner part was split into separate function.
2021-08-26 14:19:39 +03:00
Pasi Kallinen
70b953db44 Clear bypasses at beginning of main loop
Object bypass flag is used to check if an object was already
handled in an iteration loop, in cases where the linked list order
may change during iteration. The flags should never stay set
past a turn, if any were used.

Reset the bypass flags at the beginning of the main loop, without
checking g.context.move -flag; that flag gets reset if hero lifesaved.
2021-08-26 14:12:00 +03:00
PatR
f37119f6c9 unclutter dlb's main() 2021-08-26 02:25:51 -07:00
PatR
573c4c0e63 reveal elapsed time during play
Have end of game disclosure and the ^X command display the amount
of time spent playing the current game instead of just putting that
in xlogfile.

This isn't an onscreen clock for speed runners as someone recently
asked about on reddit.  NetHack shouldn't attempt to handle that.
2021-08-25 15:02:26 -07:00
PatR
48252705b8 less elapsed time: ! and ^Z
Suppress any time spent in a sub-shell or in the background when
accumulating total elapsed play time.

This won't help for leaving the game idle instead of saving and
restoring.  That's a can of worms I'd prefer to leave sealed.
2021-08-25 14:49:58 -07:00
PatR
b1f3d1f864 elapsed time handling
The code has been assuming that time_t is some number of seconds.
That's valid for traditional Unix systems and for Posix compliant
systems but is not something guaranteed by the C standard.  (We ran
into a long time ago when trying out an alternate way to calculate
phase of moon.  That code made a similar assumption and broke one
of the ports.)

'ubirthday' also warrants being re-done but I've run out of energy.
2021-08-25 14:14:23 -07:00
PatR
52f5e79790 some restore.c reformatting
Some reformatting I did while investigating the mimic-as-strange-object
vs protection-from-shape-changers situation.  Not part of the fix for
that and no change in behavior.
2021-08-24 08:20:18 -07:00
PatR
e67f45fc5c fix #K3422 - mimic remains as 'strange object'
even when protection from shape changers is in effect.  I'm not sure
why mimicking other things doesn't trigger the same sanity check
warning.  This fix works for the strange object case and I assume
that it doesn't break the more general case.

When investigating, I noticed that save and restore (even leaving
the level and then returning) causes cancelled shape changers to be
uncancelled.  Treat being cancelled similarly to having to having
protection from shape changers in effect:  shape changer is forced
to revert to its innate form and not allowed to change shape.
2021-08-24 08:09:30 -07:00
Pasi Kallinen
a1b927a278 Use enum value, not hardcoded number 2021-08-24 11:34:28 +03:00
nhmall
6ffa912359 missed dependency 2021-08-23 22:18:55 -04:00
nhmall
81134cf8d1 Merge branch 'NetHack-3.7' of https://rodney.nethack.org:20040/git/NHsource into NetHack-3.7 2021-08-22 21:06:35 -04:00
nhmall
1c869ca12f curses port 2021-08-22 21:04:19 -04:00
nhmall
81cfb5c99c git hash wasn't being used on unix 2021-08-22 20:57:49 -04:00
nhmall
96d095d08d reword fixes37.0 entry 2021-08-22 19:34:12 -04:00
nhmall
61ed041c9e Windows VS build failure if DLB wasn't defined 2021-08-22 19:25:13 -04:00
nhmall
07fadd5e69 fix nhl_loadlua() failures on Windows
The [dlb_]fopen() requires an RDBMODE argument on Windows.
ftell(), fseek(), and fread() interactions can be problematic otherwise.
2021-08-22 19:25:13 -04:00
Pasi Kallinen
6dc99f69b7 Prevent impossible trying to find a door position
When random dungeon level generation looks for room walls
to place doors at (for joining corridors or creating niches),
it complained about impossible, if the shaped theme room
doesn't have a valid place for a door.

Make the position routine return FALSE and let the
caller deal with it...

Observed this with the small circular themeroom which had
all 4 valid positions already joined with corridors, and
the niche function tried to add a niche to the room.
2021-08-22 18:44:20 +03:00
nhmall
a869a018d6 ignore visual studio .user files 2021-08-22 08:12:50 -04:00
PatR
2e92b67296 tweak baby/gold dragon tile
Make the "eyebrows" yellow instead of gray for male and female baby
and adult gold dragons.
2021-08-21 23:13:26 -07:00
PatR
1c2706e083 fixes entry for gold dragon scales in bones
Closes pull request #577
2021-08-21 22:55:57 -07:00
copperwater
89835554d8 Fix: gold dragon scale mail remained lit in bones
This is caused by the bones-pile-making routine using artifact_light()
as a test for whether it needs to call end_burn. Gold dragon scale mail
uses artifact_light(), but only returns true when its owornmask is set.
But owornmask was getting zeroed right before artifact_light() is
called. Fix is to move it right after instead.

Tested that Sunsword is not affected by this (created bones while
wearing gold dragon scales and wielding Sunsword in a dark area; when
returning to them, no light was emitted from the gravesite) because it
always returns true in artifact_light() irrespective of owornmask.
2021-08-21 22:52:10 -07:00
nhmall
f785026006 remove test bit 2021-08-21 22:51:39 -04:00
nhmall
1c270ea31b build issue without DLB defined 2021-08-21 22:47:55 -04:00
PatR
9e3eb5c7dd recent in_use comment typo 2021-08-21 13:18:48 -07:00
nhmall
12f8be6452 more visual studio build tweaks 2021-08-21 15:53:21 -04:00
nhmall
d1e49d7d67 follow-up build fixes for Windows 2021-08-21 15:48:40 -04:00
Pasi Kallinen
67b485601a sanity checking: bypassed billed object destroyed 2021-08-21 18:50:13 +03:00
nhw_cron
5316364a91 This is cron-daily v1-Jan-20-2020. files updated: Files 2021-08-21 09:14:00 -04:00
PatR
d268a8f726 sanity checking: obfree() vs obj->in_use
Drinking a potion sets the in_use flag so that it can be deleted
if found in a hangup save file.  That flag wasn't being cleared if
a shop-owned item is used up and goes onto the shop bill instead of
being discarded.  The recently revised object sanity checking was
complaining (turn after turn after turn until player paid for the
potion) that there was an object with its in_use bit set.

Restore only purges in_use objects in invent and didn't mess up
billing by getting rid such objects since they're on another list.
2021-08-21 05:36:06 -07:00
nhmall
9bb96322a8 compile NetHack-3.7 without makedefs-generated .h files
This evolves and hopefully eases the game-build requirements by
removing game-compile dependencies on any header files generated
by the makedefs utility, including:

date.h dependency and its inclusion is removed and comparable functionality
is produced at runtime via new file src/date.c.

pm.h dependency and its inclusion is removed and comparable functionality is
produced by moving the monster definitions from monst.c into new header
file called monsters.h and altering them slightly. The former pm.h header
file #define PM_ values are now replaced with appropriate emitted enum
entries during the compiler preprocessing.

onames.h dependency and	its inclusion is removed and comparable functionality
is produced by moving the object definitions from objects.c into new header
file called objects.h and altering them slightly. The former onames.h header
file #define values are now replaced with appropriate emitted enum entries
during the compiler preprocessing.

artilist.h has been slightly altered, and the former onames.h artifact-related
header file #define ART_ values are now replaced with appropriate emitted enum
entries during the compiler preprocessing.

makedefs can still produce date.h (makedefs -v), pm.h (makedefs -p), and
onames.h (makedefs -o) for reference purposes. They won't be used during
the compiler.

The other uses for makedefs remain. They are used to prepare external
file content that the game utilizes, not prerequisite code for the
compile:
    makedefs -d    (database)
    makedefs -r    (rumors)
    makedefs -h    (oracles)
    makedefs -s    (epitaphs, engravings, bogusmons)

date.c

Pull the code for date/time stamping from mdlib.c into date.c.
Set date.o to be dependent on source files, header files, and .o files
so that date.o is rebuilt from date.c when any of those changes, thus
ensuring an accurate date/time stamp. It also includes git sha
functionality formerly done by makedefs writing #define directives
into include/date.h. For unix it passes the git info on
the compile line for date.c (via sys/unix/hints/linux.2020, macOS.2020)

nethack --dumpenums (optional, but on by default)

Allow developer to obtain some internal enum values from NetHack
without having to resort to an external utility such as
makedefs.

Uncomment #define NODUMPENUMS in config.h to disable this.

The updates to sys/windows/Makefile.gcc have not been tested yet.
2021-08-21 07:59:18 -04:00
PatR
61b6bab292 potionbreathe's obj->in_use
potionbreathe() uses obj->in_use as a flag to inhibit wielded unholy
water from being dropped in case that gets broken against a monster
and triggers the hero to change from human were-critter to beast were-
critter.  Reset that to zero if caller hasn't already set it to 1.
2021-08-20 15:11:24 -07:00
PatR
191a1b01b8 ohitmon: obfree vs delobj
Make missiles that aren't launched by the hero and that hit a monster
use the routine that protects the Amulet and invocation items against
being deleted.  I don't think there are any cases where this matters
because those items don't break when they hit something, but be more
cautious.
2021-08-20 15:06:05 -07:00
PatR
f1fa497556 shk.c formatting
Mostly wrapping wide lines.  No change in behavior except one
impossible warning now ends in "?" instead of "??".
2021-08-20 15:01:36 -07:00
PatR
3736f2ba4c delobj() rejection
If the Amulet or an invocation item refuses to be deleted, make sure
the retained object doesn't get left with its in_use bit set.  I'm not
sure whether there are any cases where this matters.
2021-08-19 14:55:22 -07:00
PatR
4c31bac353 tool_in_use()
tool_in_use() [for the '(' and '*' commands] has nothing to do with
the obj->in_use bit, so rename it to tool_being_used().
2021-08-19 14:20:43 -07:00
PatR
6d291e7718 sanity check false positive for obj->nomerge
The luckstone in the Mines and the amulet of reflection or bag of
holding in Sokoban have their 'nomerge' bit set until they make
it into the hero's inventory.  So don't complain about them when
sanity_check is enabled.
2021-08-19 13:08:22 -07:00
PatR
35831023b1 when spellbook being read becomes cursed
Revisit a 3.6.1 fix.  When the hero is occupied reading a spellbook
and something causes it to become cursed without interrupting (post-
Wizard harassment's malignant aura), always stop reading instead of
just when the book's bknown flag is already set.
2021-08-18 17:40:09 -07:00
PatR
f74121d1ce extended object sanity checking
When sanity checking is enabled, check objects for bits used as
temporary flags that should always be cleared by the time that a
sanity check pass gets made:  o.in_use, o.bypass, and o.nomerge.

Also, fix glob checking.  It was unintentionally placed within
the braces of ``if (obj->owornmask) { ... }'' so didn't actually
check globs except for the unlikely case when wielded in one of
the uwep/uswapwep/uquiver slots.
2021-08-18 17:17:14 -07:00
PatR
aaf78cea4e some potion.c formatting bits 2021-08-18 13:18:26 -07:00
PatR
c99895ad20 Oselect() for monster's weapon
Make the Oselect() macro less likely to accidentally interfere with
caller's if-then-else usage.
2021-08-17 16:31:14 -07:00
PatR
91ab9b313a [not] leashing long worm['s tail]
Leashing a long worm isn't allowed so leashing its tail isn't either.
Make the rejection message be more specific for the tail case.
2021-08-17 16:26:51 -07:00
Pasi Kallinen
f43bfc3f71 Lua: diagonals for selection floodfill 2021-08-15 13:50:28 +03:00
Pasi Kallinen
98ec66e00c Qt: deprecation warnings, again
Check Qt version for the QFontMetrics::width vs horizontalAdvance.
Of course can't just #define horizontalAdvance to width, that would
be too easy ...
2021-08-15 10:58:42 +03:00
nhmall
29aca6276e fix some VS warnings that recently appeared
..\src\explode.c(884): warning C4028: formal parameter 1 different from declaration

  That one stems from commit 6b60618e0e.
  Adjust the prototype in include/extern.h to match the function definition in
  src/explode.c

  Also, a recent update to the Microsoft Visual Studio 2019 causes the
  compiler to complain while compiling a vendor c++ header (string) if
  warning C4774 is enabled.

  We force that warning to be enabled during the Makefile build, even though
  it is not enabled by default.

  Only do so in the Makefile.msc for c source files, and not for c++
  (sys/share/cppregex.cpp).

  See below for an example of the compiler complaint.

  cppregex.cpp
  C:\Program Files (x86)\Microsoft Visual
  Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include\string(530):
  warning C4774: '_scprintf' : format string expected in argument 1 is
  not a string literal
  C:\Program Files (x86)\Microsoft Visual
  Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include\string(530):
  note: e.g. instead of printf(name); use printf("%s", name); because
  format specifiers in 'name' may pose a security issue
  C:\Program Files (x86)\Microsoft Visual
  Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include\string(530):
  note: consider using constexpr specifier for named string literals
  C:\Program Files (x86)\Microsoft Visual
  Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include\string(583):
  note: see reference to function template instantiation 'std::string
  std::_Floating_to_string<float>(const char *,_Ty)' being compiled
          with
	[
	   _Ty=float
	]
2021-08-14 15:36:54 -04:00
Pasi Kallinen
6554500593 Qt: Fix Qt5 deprecation warnings
Mostly the warnings were about QString::sprintf and QFontMetrics::width.
sprintf replacement is asprintf, which annoyingly behaves differently
from sprintf - it seems to append to the string.

Not thoroughly tested, but seems to work.
2021-08-14 21:08:12 +03:00
nhmall
1b3b7b0b29 defsym.h comment update 2021-08-14 09:16:27 -04:00
nhmall
43efeda014 more sym-related content into single place 2021-08-14 08:33:38 -04:00
Pasi Kallinen
0bf4bea6ec Fix eels hiding when a pool boiled off
Sanity check caught an eel hiding on floor; this was caused by
an exploding flaming sphere boiling off the pool the eel was
hiding in. The freezing water case was already handled, so
add the same, rather lackluster handling, to the fire case.
2021-08-14 13:43:04 +03:00