Commit Graph

11800 Commits

Author SHA1 Message Date
copperwater
9c6a5fc423 Make engraving an occupation
Instead of inexplicably paralyzing the player for the duration of their
engraving. Many a character has died by trying to engrave something and
then sitting there diligently writing it while monsters surround and
attack them. (This was especially prominent back in the 3.4.3 era when
repeated Elbereths were viable, but it still occurs today with e.g.
using a hard stone to engrave Elbereth). There were also some other
oddities - for instance, if something teleported the player away while
they were engraving, they would continue to "engrave" (be paralyzed) on
their new location, but would not produce any text there; the full
engraving would be placed on their initial position.

In this commit, I have converted engraving to use the occupation
framework, which treats it as an interruptible activity. This
necessitated some logical restructuring, mostly involving the engraving
being written out in chunks as the player spends more uninterrupted time
on it.

I've tried to keep this free of regressions except for those inherent to
the occupation system.

What has NOT changed:
- The rate of engraving is still 10 characters per turn, or 1 character
  using slow methods.
- The formulas for determining how much a bladed weapon or marker can
  engrave before getting exhausted are kept. Though this is a bit
  convoluted, and if it's not considered important to preserve the
  existing behavior, I would recommend simplifying it by decreasing the
  maximum engraving length for weapons by 1 so that each point of
  enchantment simply gets you 2 characters' worth of engraving (e.g. a
  -2 weapon will only engrave 1 or 2 characters before dulling to -3,
  rather than giving it a third "grace character".
- The input buffer is still modified based on confusion/blindness/etc
  only at the time when the player inputs it (if they gain a
  debilitating status while engraving, it will not affect the text). My
  personal preference is to make the text affected in scenarios like
  that, but it's not strictly necessary to do here, so I didn't.
- Wand messages such as "The floor is riddled by bullet holes", and
  blinding from engraving lightning, still appear before the hero starts
  to take any time engraving. As noted above, getting blinded by the
  wand still has no effect on accurately engraving the text, unless the
  hero was already blind or impaired.

What has changed:
- Moving off the engraving or losing the object being engraved with
  causes the player to stop engraving.
- Wands can still engrave an arbitrary amount of text using a single
  charge, but if the hero is interrupted and decides to start engraving
  again, they will consume a second charge.

As it adds a new field to g.context, this is a save-breaking change.
2021-02-08 00:11:07 -05:00
PatR
eb0588583f potion dipping tweak
Update some code from four weeks ago.  One of two hold_potion()
calls was followed by update_inventory() but the other wasn't.
Have hold_potion() do that itself.  I'm not sure that this is
needed and haven't convinced myself that it's not.
2021-02-06 16:34:41 -08:00
PatR
67d94d2930 partial fix for #K3262 - X11 perm_invent panic
Prevent the "X Error (bad Atom)" situation that causes an
"X Error" panic.

The issue isn't fixed.  This fails to implement the intended
functionality of having the X server remember the persistent
inventory window's location across games (until the next time
that the X server restarts).  Worse, on OSX the window creeps
each time it is updated (visually it seems to be moving down by
the height of the window's title bar).

That's not as bad as having it move to the pointer's location as
it did in 3.6.1, but prior to the commit which introduced this
code that had been fixed and it stayed put during the current
game, so more work is definitely needed.
2021-02-06 16:04:44 -08:00
nhmall
4e0a1e0462 during engraving, spaces were counted instead of non-spaces
2015 commit 27d8b631cd incorrectly altered a test

	/* Chop engraving down to size if necessary */
	if (len > maxelen) {
	    for (sp = ebuf; (maxelen && *sp); sp++)
->		if (!isspace(*sp)) maxelen--;
	    if (!maxelen && *sp) {
		*sp = (char)0;
		if (multi) nomovemsg = "You cannot write any more.";

was changed to:

	/* Chop engraving down to size if necessary */
        if (len > maxelen) {
	    for (sp = ebuf; (maxelen && *sp); sp++)
->		if (*sp == ' ') maxelen--;
	    if (!maxelen && *sp) {
		*sp = (char)0;
		if (multi) nomovemsg = "You cannot write any more.";

Fixes #457
2021-02-06 18:49:16 -05:00
nhmall
4e35e8b5a6 Revert "Fix align type mixup wth align mask"
This reverts commit 2f4f7d22d3
for now while the matter is investigated further.

Also closes #459
2021-02-06 14:54:54 -05:00
Pasi Kallinen
d817564a6a Lua: set and get config options
Still needs more work, especially the error handling.
2021-02-06 19:02:25 +02:00
nhmall
c4d9ceda9d Windows sys/winnt/Makefile.msc update 2021-02-05 19:54:15 -05:00
nhmall
bf3c84a4ce wasm cross-compile bit 2021-02-05 19:16:49 -05:00
nhmall
30bb6525b2 add -Wdeprecated-copy if clang and clang >= 9 2021-02-05 16:28:09 -05:00
nhmall
d344e61da1 typo fix 2021-02-05 10:03:18 -05:00
nhmall
5003a0578c sync some macOS hints changes to linux hints 2021-02-05 09:51:07 -05:00
nhmall
769b8877fc separate the C compiler flags and C++ compiler flags where needed 2021-02-05 09:45:03 -05:00
nhmall
f8785792bd potential fix for the macOS issue encountered
Some build flags were unintentionally overlooked in a previous change
2021-02-05 09:38:35 -05:00
nhmall
d714eca924 roll back a Makefile.src change due to macOS issue afterwards
Requires further investigation
2021-02-05 07:43:51 -05:00
Pasi Kallinen
9e550ccb07 Fix BIND segfault
Recent commit that added terminator entry to default_menu_cmd_info
caused a segfault when trying to BIND keys.
2021-02-05 11:14:14 +02:00
PatR
74213666bf curses: honor menu_next_page/&c option settings
tty and X11 honor the menu_xxx options.  Qt currently doesn't
support menu manipulation by keyboard.  curses does support that
but was only handling the default menu keys.
2021-02-05 01:04:48 -08:00
nhmall
b14c47132f more cross-compile warning bits
maximize warnings for NetHack sources
minimize warnings for Lua and pdcurses which we won't be changing
2021-02-04 19:42:07 -05:00
nhmall
d2f570154a another old-style-definition 2021-02-04 19:40:38 -05:00
nhmall
c87b556f42 more msdos cross-compile pdcurses warning suppression 2021-02-04 18:53:18 -05:00
nhmall
fd970e58a2 warnings in cross-compile of pdcurses are not desired 2021-02-04 18:41:07 -05:00
nhmall
4380b4e3e4 progress detail in the CI log file is too verbose 2021-02-04 18:04:11 -05:00
Bart House
1efae34cc7 Disable warning 4774 for lua source files. 2021-02-04 11:28:41 -08:00
nhmall
2dd982d62c follow-up on the util/recover.c change earlier
It failed in the CI
2021-02-04 12:50:53 -05:00
nhmall
0f58e0bdee Revert "follow-up on the util/recover.c change earlier"
This reverts commit 54e984c70c.
2021-02-04 12:48:51 -05:00
nhmall
54e984c70c follow-up on the util/recover.c change earlier
It failed in the CI
2021-02-04 12:47:03 -05:00
nhmall
0e051018e7 set but not used warning in util/recover.c
../util/recover.c:416:9: warning: variable 'bsize' set but not used [-Wunused-but-set-variable]
  416 |     int bsize;
      |         ^~~~~
2021-02-04 07:40:55 -05:00
PatR
304d74515a some options tidying
Somehow several arrays of compound option values ended up in
between defining menu_cmd_t and using menu_cmd_t.  Reorder them.

Also, add a terminator to the list of menu commands so that it
could potentially be used manipulated from other source files
that don't have access to the array size.
2021-02-04 01:35:58 -08:00
nhmall
91558e5ce9 another duplicate entry in Xcode project file 2021-02-03 22:04:15 -05:00
nhmall
b00677223d remove a duplicate entry in Xcode project file 2021-02-03 22:03:04 -05:00
nhmall
2cfd5784f2 add missing lua files to Xcode build 2021-02-03 21:52:42 -05:00
PatR
bb87d620a9 Couple of Xcode setup documenation bits 2021-02-03 17:10:49 -08:00
PatR
52ae2b9df3 prevent lua crash upon init failure
panic() instead, so not much help to the player.
2021-02-03 17:09:35 -08:00
PatR
14cb015d72 Qt close-window handling
Handle the unused variable 'ok' differently.
2021-02-03 13:42:17 -08:00
nhmall
78532e3855 Qt follow-up bit 2021-02-03 15:36:00 -05:00
nhmall
44b16979cf unused-but-set-variable warning in qt_main.cpp
../win/Qt/qt_main.cpp: In member function ‘virtual void nethack_qt_::NetHackQtMainWindow::closeEvent(QCloseEvent*)’:
../win/Qt/qt_main.cpp:1377:9: warning: variable ‘ok’ set but not used [-Wunused-but-set-variable]
 1377 |     int ok = 0;
      |         ^~
2021-02-03 15:33:30 -05:00
nhmall
21ca9e1ec5 Qt setChecked() takes a boolean argument 2021-02-03 15:21:38 -05:00
Patric Mueller
8d7d159be1 Fix spelling error in Samurai quest 2021-02-03 20:31:01 +01:00
nhmall
5e93fd06c0 ensure build with old linux-qt5 hints 2021-02-03 13:46:13 -05:00
nhmall
83246a9634 remove debugging statement from warnings.h 2021-02-03 13:25:50 -05:00
nhmall
8b21a170fb clear a number of Qt build warnings on linux related to compiler flags
option ‘-Wimplicit’ is valid for C/ObjC but not for C++
option ‘-Wimplicit-function-declaration’ is valid for C/ObjC but not for C++
option ‘-Wimplicit-int’ is valid for C/ObjC but not for C++
option ‘-Wmissing-prototypes’ is valid for C/ObjC but not for C++
option ‘-Wmissing-parameter-type’ is valid for C/ObjC but not for C++
option ‘-Wold-style-definition’ is valid for C/ObjC but not for C++
option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
2021-02-03 13:18:43 -05:00
nhmall
c5b74aee63 variable set but not used warning in qt_yndlg.cpp
../win/Qt/qt_yndlg.cpp: In member function ‘char nethack_qt_::NetHackQtYnDialog::Exec()’:
../win/Qt/qt_yndlg.cpp:80:9: warning: variable ‘ch_per_line’ set but not used [-Wunused-but-set-variable]
   80 |     int ch_per_line=6;
      |         ^~~~~~~~~~~
2021-02-03 12:56:55 -05:00
nhmall
8f3dc3b21b prevent a warning about a multi-line comment in qt_svsel.cpp 2021-02-03 12:51:26 -05:00
nhmall
7900632b50 Qt c++ function name shadow warnings
We have a struct called mkroom and a function called mkroom()
so c++ complains about the mkroom() function hiding the
initializer for the struct.

Similarly, we have a struct called attack and a function
called attack().

There may be a more elegant way of eliminating those two
warnings, but renaming mkroom() to do_mkroom() and
attack() to do_attack() was straightforward enough.
2021-02-03 10:55:07 -05:00
nhmall
24c829ecf7 wording fix 2021-02-03 09:42:59 -05:00
nhmall
b1e5c99906 extend the Qt clang fix pertaining to shadowing of global variables to g++ 2021-02-03 09:22:57 -05:00
nhmall
7b454f8ba3 Windows format string bits 2021-02-02 21:55:34 -05:00
keni
4c16f74b7f Merge branch 'NetHack-3.7' of https://rodney.nethack.org:20040/git/NHsource into NetHack-3.7 2021-02-02 20:46:54 -05:00
keni
97141cd421 src/end.c: improve backtrace text spacing (see #K3259) 2021-02-02 20:45:45 -05:00
nhmall
6f3337b75a more macOS whitelisting
X11, Qt, and util

also ensure the functional warnings.h macro definitions are used
with c++ clang compiler
2021-02-02 20:11:43 -05:00
nhmall
9684b75f54 whitelist some macOS clang format-nonliteral warnings 2021-02-02 19:50:07 -05:00