Commit Graph

6444 Commits

Author SHA1 Message Date
Pasi Kallinen
98383f7a46 Win32GUI: Prevent ampersand-escaped mnemonics in menus 2017-09-18 15:30:52 +03:00
Pasi Kallinen
5e05cdc570 Change some regex stuff to use config errors 2017-09-17 13:43:48 +03:00
Pasi Kallinen
45401a13bb Show regex error before asking for color
When entering a new menucolor via options, show regex error
immediately afterwards, instead of asking for color and attribute
before showing the error.

Also actually show config errors even if config error handler
hasn't been initialized.
2017-09-17 13:20:28 +03:00
Pasi Kallinen
78e5c9a10a Win32GUI: Allow empty separator lines in menus 2017-09-17 12:17:46 +03:00
Pasi Kallinen
11863dd5e9 Read symbols with config file handler
Also, make config file error handler able to cope with recursion.
2017-09-17 10:15:08 +03:00
Pasi Kallinen
2db7e20116 Fix invisible gold symbol in status lines 2017-09-16 23:49:28 +03:00
Pasi Kallinen
f36d1036de Show in wizmode level teleport menu your current location 2017-09-16 18:19:25 +03:00
PatR
21802dbb4f fix #H6042 - leash use while engulfed
Prevent using a leash while engulfed.  If someone wants to supply a
better message, go ahead.  I just tried to get the logic straight.
(The new swallowed part is easy; the previous lack of handling for
remembered unseen monsters wasn't quite so easy.)

Applying a leash was always using a move, even if player cancelled
at the prompt to pick an adjacent monster.  Now some of the early
exits don't use a move.
2017-09-16 00:43:03 -07:00
Pasi Kallinen
52ed881b2c Remove overview for wizmode regenerated map
The wizmakemap command throws away the current level, so don't keep
the overview data for it around.
2017-09-15 14:45:51 +03:00
PatR
782db48fb5 'fix' #H5531 - breath damage
For breath damage, the 'S' in NdS is ignored.  'N' for the number of
dice is used, but for number of sides of those dice, 6 is used for
most damage types.  Add a comment to that effect to monst.c and change
a few Nd8 to Nd6 so that viewing the monster definitions matches what
they actually do.
2017-09-15 04:34:05 -07:00
PatR
c38dc0edc0 zap.c formatting 2017-09-15 04:33:09 -07:00
Pasi Kallinen
f8bd77ae03 Use symbolic names for shop repair costs
...and add costs to two places where the door you touched
blew up (picking the lock and opening the door).
2017-09-14 21:07:18 +03:00
Pasi Kallinen
cfedd8659d Minor reformat, fix warnings 2017-09-14 14:40:11 +03:00
Pasi Kallinen
0753a0751e Move BoH item loss into separate function 2017-09-14 14:11:09 +03:00
PatR
8ff02c11d9 fix #H5856 - Amulet draining energy
The sequence
  You feel the amulet draining your energy away.
  You don't have enough energy to cast that spell.
didn't use any energy or cost any time so the player could try over
and over until the randomly chosen drain amount happened to be low
enough to succeed.

The old behavior was that the cost of the current cast attempt got
incresed by a random amount.  Now, if hero already lacks sufficient
energy to cast the spell, the Amulet's effect won't take place, the
second message will be given, and no energy or time will be consumed.
When there is enough energy to cast the spell, the drain effect will
occur and some energy will be used up immediately (instead of
increasing the cost of this attempt).  The energy drain might then
result in the second message, but if so, a turn will be used.

No longer increasing the energy cost of the current cast has a
side-effect on not increasing the hunger penalty for the current cast
(since that is based on the energy cost) but the energy drain message
doesn't actually imply any effect on hunger.
2017-09-14 00:57:50 -07:00
PatR
cd8f028352 sys/unix/*.c formatting and PANICTRACE fix
I started out just reformatting the function header for regularize()
but ended up doing miscellaneous other stuff, including some code
changes.  I think the CHDIR code is a bit cleaner now, but shouldn't
have any differences in behavior.

Along the way I noticed that 'nethack -dpath' or 'nethack -d path'
modifies argv[] before PANICTRACE attempted to save argv[0], so would
break having nethack invoke gdb to get a backtrace.  ('ARGV0' seems to
be unnecessary since 'hname' holds the same value, but I didn't get rid
of it....)
2017-09-13 15:33:43 -07:00
Pasi Kallinen
127f74bb24 Fix more warnings 2017-09-13 14:12:38 +03:00
Pasi Kallinen
1e22a9aaf7 Win32GUI: Allow toggling mouse_support off
Prevents accidental mouse clicks on the map
2017-09-13 14:02:43 +03:00
Pasi Kallinen
bd7568b71d Fix compile warnings 2017-09-13 13:59:25 +03:00
PatR
08210049cb warning feedback
When polymorphed into a vampire, I saw an '@' in the distance, and
examining that with the cursor yielded "[seen: warned of shopkeepers]".
Fix that to be "warned of humans".  (Vampires are warned of "humans
and elves" but this is a place where being more specific seems better.)
2017-09-13 03:39:19 -07:00
Pasi Kallinen
b6737fd1f6 config parse return values and error msgs 2017-09-13 13:26:37 +03:00
Pasi Kallinen
2c688a12d5 Handle config file reading at single function
The function handles comments, empty lines, config sections,
CHOOSE, and line continuation, while calling another function
for other lines.

Currently used for config file, sysconf, and WIZKIT.
2017-09-13 12:27:38 +03:00
PatR
cb1309cd41 address #H5931 - bug with shape-shifted vampires
[Subject was actually "possible bug with shape-shifted vampires".]
The observation was that a pet vampire which took on fog cloud form
would just stay a fog cloud, rendering it nearly useless as a pet.
Fog clouds are too weak to attack dangerous monsters so are rarely
subject to damage from counter-attacks, so they wouldn't even get
killed to revert to vampire form.

Make a vampire in fog cloud form--hostile or tame--sometimes change
to bat form if not in view or out of missile range (the same criteria
used by vampires to change into alternate shape to begin with).  Bats
are slightly more useful as pets and definitely more prone to revert
to vampire.  The potential transformation from bat to cloud isn't
done randomly; that already occurs when encountering closed doors.
2017-09-12 18:40:14 -07:00
PatR
3731afbc6b vampire shift to fog cloud
If a vampire, possibly in bat form, on the far side of a closed door
shifted shape to fog cloud in order to pass under the door, you were
told about the shape change if you could see it after being placed at
the door's location even if you couldn't see the vampire's pre-move
location.  This is a bug introduced after 3.6.0....
2017-09-12 18:26:14 -07:00
PatR
5710944258 address #H5590 - paranoid_confirm vs lycanthropy
Polymorph control gives the player a chance to accept or reject a form
change due to lycanthropy, but if it occurs during combat or movement
the player might type 'y' before realizing that the prompt is pending.
Provide a paranoid_confirmation setting for 'Were-change' to allow a
player to require "yes" instead of 'y' for that.

The existing setting 'wand' is renamed to 'wand-break' and now requires
at least two letters in the config file options instead of just 1.  The
spelling of its synonym is changed from 'breakwand' to 'break-wand';
it can be shorted to as few as 2 letters (same as before) but if more
than 5 are present, the new dash is required.

Both 'wand-break' and 'Were-change' are placed before 'pray' in the 'O'
menu for paranoid_confirmation so that all the "yes" vs 'y' settings
are grouped together.

Bonus fixes:
Reverting from were-critter form to human (due to timeout) did not give
a player with polymorph control the option of remaining in creature
form; now it does.
The 'O' command's menu would not show "wand" (now "wand-break") in the
current value of paranoid_confirmation.  (A post 3.6.0 issue, so no
fixes entry included.)

The revised Guidebook.mn has been tested; Guidebook.tex has not.
2017-09-12 04:14:44 -07:00
PatR
8d1e0d1756 muse vs wand of teleportation
Reported directly to devteam, case WAN_TELEPORTATION in use_offensive()
is never used.  Disable it, although this also adds other disabled code
which would make it become used if enabled.
2017-09-11 18:58:48 -07:00
PatR
863736f6bf onscary() vs "Elbereth"
When checking whether hero is on a protected spot, don't check for
engraved "Elbereth" unless/until other conditions have been exhausted.
2017-09-11 18:47:26 -07:00
PatR
9846984fd8 quest artifact followup
Fix a typo/thinko that ended up being magnified by copy+paste.

I did test having the artifact be carried by a monster, but it was the
nemesis who accompanied me from the level above when I level teleported
back to his lair.  He must have ended up as first monster in fmon chain
when he was placed on the level.
2017-09-11 16:22:14 -07:00
PatR
2b8c2eac23 fix #HH5887 - Dark One / Eye message bug
Some roles' quest message when returning the nemesis lair refer to
sensing the presence/aura/whatever of the quest artifact, but it might
not be there anymore.  In reported case, the nemesis had picked it up
and later fled up the stairs to another level.  Other situations are
possible; it's feasible for the hero to already have it.  So provide
an alternate message, and some extra code to decide whether to use it.

Other anomalous messages, such as looking down on the dead body of a
nemesis who didn't leave a corpse, can still occur.
2017-09-11 15:59:50 -07:00
PatR
d8f4c14c06 option warnings
Fix a couple of warnings in options.c, and simplify feature_alert_opts()
in the process.

options.c:1126:30: warning: format string is not a string literal
      (potentially insecure) [-Wformat-security]
            config_error_add(buf);
                             ^~~
options.c:1667:9: warning: unused variable 'i' [-Wunused-variable]
    int i, c = NO_COLOR, a = ATR_NONE;
        ^

There are still a couple of warnings in files.c, but fixing them will
impinge open potential reversal of the CONFIG_ERROR_SECURE patch so
I've left them alone for the time being.  The second one is because
VA_START() and/or VA_INIT() do more than just declare stuff; C99 doesn't
care, but for C90 (or pre-ANSI) the local variable should be declared
before them.

files.c:2816:12: warning: address of array 'buf' will always evaluate to
      'true' [-Wpointer-bool-conversion]
          (buf && buf[0]) ? buf : "Unknown error");
           ^~~ ~~
files.c:2799:10: warning: ISO C90 forbids mixing declarations and code
      [-Wdeclaration-after-statement]
    char buf[BUFSZ];
         ^
2017-09-10 16:04:37 -07:00
Pasi Kallinen
cbd5934a1a No secure config errors in linux hints file
The linux hints file is for a single-user build, no need for this.
2017-09-10 21:31:41 +03:00
Pasi Kallinen
9c118b5b6b Secure config errors
If user can make NETHACKOPTIONS point to a file, that user could then
get the file contents via the extended config file error reporting.
Add CONFIG_ERROR_SECURE compile-time option to make that case output
only the first error, no line number or error context.
2017-09-10 21:05:51 +03:00
PatR
0d24113577 Band-Aid (tm) for #H5091 - old passive attack
Change the wording slightly if the hero simultaneously (in theory)
reverts to normal form and splahes acid on his/her attacker.  Giving
the passive counterattack message first would be better, but several
types of counterattacks need to know in advance whether the hero has
reverted, producing a chicken-vs-egg seqeuncing situation.

I also took out 'register' directives from a bunch of declarations
since they'd been pretty much applied blindly rather than in
circumstances where someone evaluated the situation and decided that
they might matter.
2017-09-09 16:51:38 -07:00
PatR
9f15c7190a formatting bit
The formatting bit actually warranted a cast.
2017-09-09 16:32:30 -07:00
PatR
263bd05fa0 fix #H6015 - 'crash' on NAO
Reported for nethack.alt.org where impossible events in to-be-3.6.1
trigger a panic instead of just a warning, being polymorphed into a
vampire and draining something to 0 HP (rather than killing it with
the bite attack) didn't properly kill off the victim unless it was
also being drained from level 0 to level -1, resulting in impossible
"dmonsfree: 1 removed doesn't match 0 pending".  If the hero got
another move before dead monsters were purged, applying a stethscope
to the victim could trigger an actual crash rather than an impossible
escalated to a panic.  Other actions such as attacking again probably
could too.

A followup included a diagnosis and one-line patch.  I expanded the
adjacent comment when manually putting the patch into place.
2017-09-09 16:21:22 -07:00
Pasi Kallinen
a4becd6970 Last of the config error handling 2017-09-09 18:10:15 +03:00
Pasi Kallinen
b9c52ff31c Even more config error handling 2017-09-09 17:41:08 +03:00
Pasi Kallinen
873590afc1 More options parse return values 2017-09-09 14:03:28 +03:00
Pasi Kallinen
cfb09c9bf8 Handle windowtype and CHOOSE config errors 2017-09-09 13:50:34 +03:00
Pasi Kallinen
87f991ecfc Show error on unknown line 2017-09-09 13:25:46 +03:00
Pasi Kallinen
f8211f69f2 Improve config file error reporting
Show the original line from the config file, followed by the line number and
a specific error message. Also show all errors from the config file before
waiting for key press.
2017-09-09 13:04:08 +03:00
Bart House
70ac8a12af Improvements to build.bat scripts used to build Windows builds. Remove CRT Secure warnings. 2017-09-05 13:14:13 +03:00
PatR
056ac5fe64 debug tweak
Theoretically we still support implementations which don't have %p.
Even if we didn't, it requires a 'void *' argument rather than an
arbitrary pointer, so casts would have been needed.
2017-09-04 15:19:37 -07:00
Bart House
51f7cb5e9d Fix build errors with Visual Studio 2017 using latest SDK. We have yet another global namespace collision between window headers and nethack headers. This time it is the macro Protection that is defined before it is used in a function prototype in the windows headers. 2017-09-04 12:56:20 +03:00
Bart House
1bc3cbac7f Additional changes needed to support Visual Studio 2017. 2017-09-04 12:56:20 +03:00
Bart House
8a5351c079 Upgrade to VS2017 and newer SDK. 2017-09-04 12:56:20 +03:00
Bart House
3614059379 Fix line endings (CRLF and extra space). 2017-09-04 12:56:20 +03:00
Bart House
5b08481637 Adding vs2015 solution file to starting set of files. 2017-09-04 12:56:19 +03:00
Bart House
ceaf2f6109 Create initial vs2017 files from vs2015 files. 2017-09-04 12:56:19 +03:00
Bart House
be4e0992e6 Fix crash that occurs when closing application window while invetory is displayed. 2017-09-04 12:52:18 +03:00