Don't allow running/travel when stunned/confused

Autoexplore already does this, but the code for it is now bundled with
this fix.

While we're at it, ensure flags.run is set to 0 when movement is blocked
in command_input() and when occupations are stopped or finished by
unmul().  Otherwise, normal movement could be stopped by stunning or
confusion when it shouldn't be.

This is related to commit a7f6b941a5 (interrupt running/travel/
autoexplore when confused).

This bug also exists in upstream NitroHack.

Fixes #83 on GitHub.
CS1480,1539: Enhance paranoid_water, include swamp

paranoid_water now stops the player from walking into muddy swamps as
well as water.

paranoid_water and paranoid_lava only warn if you're not already over
the terrain in question.
CS1353: autounlock when #looting locked containers

If a container is found to be locked when trying to open it and a
suitable unlocking tool is found, ask to unlock it.  Originally from
UnNetHackPlus.

The #loot command still needs to be used again to actually open the
container; ideally this would happen after the container is successfully
unlocked.

Compared to UnNetHack, answering 'y' to picking the container's lock
doesn't ask to loot to other containers on the same space.
Fix replay hiccup from port of autounlocking doors

The variable dz in pick_lock() is left uninitialized if non-zero rx and
ry arguments are given to the function which, when checked later in the
function, leads to desync between a game and its replay.

This is meant to go with commit ff361dbf02 (CS884 ask to unlock when
opening locked doors).
Init/save/restore resumable occupation state

Setting traps, removing armor and unlocking containers now clear, save
and restore their state between games played in the same process, so
they can be reproduced in replays without causing desync errors.

The code for saving the state for unlocking containers is messier than
that of, say, setting traps because of the risk of dangling pointers,
which trap-setting avoids by always zeroing pointers after itself.

This bug also exists in upstream NitroHack.
Autounlock #loots containers after unlocking

When the player chooses to autounlock a container when looting, the
looting menu will be shown once the container has been successfully
unlocked.  At long last, this makes locked containers as easy to loot as
unlocked ones; it's even better with NetHack4's 'a,' #loot shortcut.

Credit to Bulwersator for the idea.
CS1182: Wrap from Z to a in level teleport menu

This only affects wizard mode, where it prevents the level teleport menu
using nonsense characters for the last entries.
NH4: Fix to show objects & traps on Plane of Water

This fixes the bug where objects and traps on the Plane of Water would
appear as water spaces from afar, due to the map_foo() functions calling
dbuf_set() based on the hero memory of spaces, which isn't updated on
the Plane of Water.

This does not fix a related bug where the same objects and traps are
still described as water in description messages.

Fix to show objects and traps on water level.
Jared Minch <jmminch@gmail.com>
c3381e381fd91913e5958302d2840d717650732e
Fix position descriptions on the Plane of Water

This gives correct descriptions for terrain, objects and traps on the
Plane of Water, fixing e.g. far-look messages.  Interesting note: the
walkable part of the bubbles in the Plane of Air is described as "air".

This bug also exists in upstream NitroHack and NetHack4.
Use attr_t instead of int for Curses attributes

This ensures colors always work with PDCurses, no matter how it is
compiled.
Give curses_color_attr() in-game color constants

... instead of Curses color constants, since the whole point of the
function is to convert the former to the latter.  This fixes faulty
colors with PDCurses under some circumstances.

This is meant to go with commit f5a556f501 (NH4 --More-- by screenfuls,
not by lines), commit 6800dc7570 (No-inverse name-HP bar uses black
background) and commit 6e1348de86 (Color-code turn count changes).

This bug also exists in NetHack4.
oprops: Fix "thirsty knife of drain resistance"

Dumb mistake on my part; it should just be "thirsty knife" for weapons
and weapon-tools.

This is meant to go with commit d7d07e4d60 (oprops: magical object
properties from GruntHack).
Native Windows support with MinGW

The game can now be compiled with the MinGW toolchain, creating a native
Windows version of the game that requires no other dependencies to run.
At last, proper Windows support has been restored!

The rough steps (proper instructions for the readme to come):

 1. Install MinGW.
 2. Right click "Computer" -> "Advanced Settings" ->
    "Environment Variables".
 3. Add new PATH variable, set it to "C:\MinGW\bin".
 4. Console: mingw-get install msys-flex-bin msys-bison-bin mingw-libz
 5. Download and extract the latest Jansson off GitHub.
 6. Edit out -fPIC from Jansson's top-level CMakeLists.txt.
 7. Launch CMake, point at Jansson, "Configure" and "Generate".
 8. Build and install Jansson with 'mingw32-make install'.
 9. Download and extract PDCurses.
 10. In PDCurses' win32 folder: mingw32-make -f mingwin32.mak WIDE=Y
 11. Rename "pdcurses.a" to "libpdcurses.a".
 12. Download and extract this game's source code.
 13. Launch CMake, point it to this game's source code.
 14. Set BISON_EXECUTABLE to "C:\MinGW\msys\1.0\bin\bison.exe"
     and FLEX_EXECUTABLE to "C:\MinGW\msys\1.0\bin\flex.exe".
 15. Set Jansson and PDCurses include and lib paths.
 16. Set final install path for the game (same path for all is fine).
 17. Click "Configure" and "Generate".
 18. In the game's build folder: mingw32-make install
 19. The game can be found in the install path, ready to play/zip up.

MinGW is a fraction of the size of Cygwin (200~ MB vs. 500~ MB), but the
game standalone is just 3 MB.

Known issue: ALL_STATIC option fails to link the final EXE properly,
since its link line doesn't include the lib path for Jansson.
Build instructions for MinGW on Windows

Screw maximum line widths, I'll just use Markdown.
NH4: Perform line wrapping for long messages

This also extends the maximum length for messages stored in history to
the length of the message itself, rather than topping off at 118
characters.

Compared to NetHack4, this frees memory allocated to individual messages
in msghistory when cleanup_messages() is called.

Perform line wrapping for long messages.
Jared Minch <jmminch@gmail.com>
ed9a5ee3567ec35df6d1e73477429682b5c14bd2
Improve Ctrl-P previous message display

Long messages are now wrapped, and the turn count for messages is no
longer repeated.
Heavyshot: damage multiplier instead multishot

Some thrown or fired weapons now do 1dX damage where X is the skill
level:

 * crossbows
 * spears
 * javelins
 * shuriken
 * boomerangs

Heavyshot replaces multishot for weapons that had it, i.e. crossbows and
shuriken.

Spears now get a racial +1 skill for this calculation.

Javelins now get +1 skill for this calculation at basic skill or above,
so the bonus counts 1/2/3/4 instead of 1/1/2/3 for
unskilled/basic/skilled/expert.

This fixes a minor NetHack bug where monsters can multishot when stunned
even though the player cannot.
NH4: Fix off-by-one in color map

Fix off-by-one in color map
Alex Smith <ais523@nethack4.org>
cf85ae9154a7b27cb95e3907049e17b48fb99198
Revert "Fix position descriptions on the Plane of Water"

This reverts commit ef24a8ae0b57dbbc68a28c3b9ebec93dcfe770c8.

This commit was causing objects with a randomized appearance to be
double obfuscated, so they'd have different descriptions when viewed
from afar and in the inventory.  This also broke the special description
logic for Sokoban prizes, i.e. true object name when seen and "a sokoban
foo" when not seen.

The problem that this reverted commit was trying to fix is that
nh_describe_pos() needs level memory to do its job, but the Plane of
Water doesn't have it.  I tried using the dbuf (display buffer) for this
no-level-memory case instead, but the dbuf is post-object-obfuscation,
and describe_object() used by nh_describe_pos() needs
pre-object-obfuscation data, otherwise the visible and actual object
types mismatch, causing describe_object() to create a fake object based
on the visible object type and use that to get the object name, which in
this case produces a completely incorrect name.

The real fix for this problem is not trivial, since nh_describe_pos()
and friends need (struct rm *) data, but for the Plane of Water that
data is created temporarily and disposed of once it's been used to
populate the dbuf, which is too late in the display pipeline to use.
The map_foo() functions compile this info and would be usable if they
didn't also reveal info, which is bad for a player-controllable cursor.
They could still be used if cansee() is identical to the vision rules on
the Plane of Water.
oprops: Fix artifact beheading, Mjollnir message

The beheading (and slicing) effect of Vorpal Blade and Thiefbane (and
the Tsurugi of Muramasa) was broken by the artifact_hit() refactoring.
Mjollnir was doing its damage, but the special hit message wasn't being
shown.

This is meant to go with commit d7d07e4d60 (oprops: magical object
properties from GruntHack).

This fixes #84 on GitHub.