Commit Graph

7616 Commits

Author SHA1 Message Date
nhmall
dc1e2da359 Windows startup modifications
Changes to be committed:
	modified:   include/winprocs.h
	modified:   src/options.c
	modified:   sys/share/pcmain.c
	new file:   sys/share/safeproc.c
	modified:   sys/winnt/Makefile.msc
	modified:   sys/winnt/stubs.c
	new file:   sys/winnt/windmain.c
	modified:   sys/winnt/winnt.c
	modified:   win/win32/vs2017/NetHack.vcxproj
	modified:   win/win32/vs2017/NetHackW.vcxproj
	modified:   win/win32/winhack.c

Because multiple window ports are supported on Windows
now, even in the same executable and selectable via
config file in some cases, some adjustments became
necessary. There will likely be some further refining
of this over the next day or two.

List of changes:

Move Windows startup from sys/share/pcmain.c and
into its own sys/winnt/windmain.c so that it can
be modified to fix some current breakage, and
allow altering the order of some things.

There is startup processing code that is common to
all of the Windows WindowPorts, but that startup
processing code needs to have no dependency on
any one of those WindowPorts.

Yet, during startup processing, some of the initialization
routines can end up calling NetHack functions that
expect an active Window port underneath, and if there
isn't one, routines like pline, impossible, panic can
end up invoking null function pointers.

Place a new file sys/share/safeproc.c, in which a complete
window port is available for early startup processing
purposes. It's WindowPort name field is set to
"safe-startup" just for reference.  The prototypes in
include/winprocs.h require that SAFEPROCS be

Usage:

 windowprocs = get_safe_procs(0);
initializes a set of winprocs function pointers that ensure
none of the function pointers are left null, but that's all it does.

 windowprocs = get_safe_procs(1);
initializes a set of winprocs functions pointers that ensure
none of the function pointers are left null, but also
provides some basic output and input functionality using nothing
other than C stdio routines (no platform or OS specific code).

The conditional code related to WIN32 has been removed from
sys/share/pcmain.c

The code common to all of the Windows WindowPorts calls
get_safe_procs() almost immediately to ensure that
there is a set of WindowPort winprocs available.
2018-12-08 17:56:20 -05:00
PatR
2255543800 recursive destroy_item()
Make the sequence:
  be zapped by lightning,
  have worn ring of levitation be destroyed,
  fall onto fire trap
work better.  The fire trap handling will mark everything in inventory
as already processed; anything vulnerable to lightning past the destroyed
ring would not be checked.  So delay destroying such a ring until after
all of inventory has been subjected to lightning.
2018-12-07 16:51:18 -08:00
PatR
e8a5ff6dff gold highlight bit
Keep type/value straight:  'update_all' is boolean, not ordinary int.
2018-12-07 16:37:24 -08:00
nhmall
6ff9753029 back out some spider changes
After consultation with the original committer, this
is being pulled out, possibly revisited later. There was
originally meant to be a follow-up piece to this that he
never had a chance to integrate for various reasons.
2018-12-07 19:12:56 -05:00
Pasi Kallinen
8319227b55 Clear the getlin buffer
Recent change to this bit of code didn't clear the buffer,
which causes garbage in the string if compiled with EDIT_GETLIN
2018-12-07 22:18:53 +02:00
nhmall
89d165b501 Merge branch 'NetHack-3.6.2-beta01' of https://rodney.nethack.org:20040/git/NHsource into NetHack-3.6.2-beta01 2018-12-07 09:40:38 -05:00
nhmall
a1c1acdd24 add MM_NOGRP makemon() flag
add MM_NOGRP makemon() flag as a means of suppressing groups of monsters in
a couple places that warrant it when a specific monster type isn't
specified on the call to makemon()
2018-12-07 09:29:01 -05:00
PatR
f3c4a52e36 menucolors
In the 'special options' section at the end of 'O's menu, change the
spelling for the menucolors entry to "menu colors" so that it isn't
spelled exactly the same as the 'menucolors' boolean option.  Only
affects what the player sees when reading that menu.

If player uses 'O' to add any menu colors and 'menucolors' boolean is
Off at the time, give a reminder to toggle it to On in order to have
those menu colorings become active.  (Adding hilite_status entries has
a similar reminder for 'statushilites' if done while that is 0.)
2018-12-07 01:20:20 -08:00
PatR
9e170baecc fix #H7655 - highlighting gold
With options along the line of
 OPTIONS=statushilites:4
 HILITE_STATUS=gold/always/yellow
gold started out unhighlighted (unhighlit?).  I didn't try to figure
out why, just changed things to force a full status update when gold
requires internal changes (different \G encoding or different glyph)
which is something that happens when session first enters moveloop().
2018-12-07 00:36:38 -08:00
nhmall
150d01a965 add MM_ASLEEP makemon() flag and honor it for fill_zoo 2018-12-06 22:30:15 -05:00
PatR
e9624f2583 fix #H7686 - destroy_item()'s inventory traversal
Inventory traversal can be disrupted when items being traversed are
able to change inventory.  I've lost track of how many times this
sort of thing has been discovered.

Report claimed that boiled potion of polymorph caused transformation
which resulted in dropped weapon and dropped or destroyed worn armor.
That was evidently a guess; potionbreathe() for that potion only
abuses constitution.  The traceback showed 'you_were()' was involved.
Boiled potion of unholy water triggers human-to-beast transformation
of hero inflicted with lycanthropy, yielding similar situation.

I didn't notice anything unusual when reproducing this but inventory
was definitely vulnerable.  My 'one line' fixes entries are steadily
getting to be more verbose; I may have to go back to 'fix bug'.  :-}
2018-12-06 17:27:36 -08:00
nhmall
a9e8ad9236 Merge branch 'NetHack-3.6.2-beta01' of https://rodney.nethack.org:20040/git/NHsource into NetHack-3.6.2-beta01 2018-12-05 23:45:56 -05:00
nhmall
1baa20dfc5 header update on cursstat.c 2018-12-05 23:43:59 -05:00
PatR
e5b232104e more green slime
When a hero dies due to turning into green slime, actually polymorph
him into a green slime monster before killing him off.  That way he'll
show as a green 'P' on the map instead of white '@' during final
disclosure.  Also, armor that gets destroyed by polymorphing into that
form will be absent from resulting bones file.
2018-12-05 14:56:03 -08:00
nhmall
c4930c6782 update header on curswins 2018-12-05 17:45:40 -05:00
nhmall
9c873712b6 update header on cursstat 2018-12-05 17:45:15 -05:00
nhmall
2458281d42 update header on cursmisc 2018-12-05 17:44:08 -05:00
nhmall
c260911f38 update header on cursmesg 2018-12-05 17:43:33 -05:00
nhmall
661ffb0133 update header on cursmain 2018-12-05 17:42:49 -05:00
nhmall
86281c5555 update header on cursinvt 2018-12-05 17:42:11 -05:00
nhmall
14335ea90c update header on cursinit 2018-12-05 17:41:30 -05:00
nhmall
c258f9c3f8 update header on cursdial 2018-12-05 17:40:33 -05:00
Pasi Kallinen
857b8af2ee Add missing valid location descriptors 2018-12-05 23:15:14 +02:00
Pasi Kallinen
f020595fb7 Valid cursor locations showed null
When getting a cursor location, and there was no "valid" location
function defined, trying to go to the next or previous valid
location showed null.

Fix this by using the "interesting" locations if no valid ones.
2018-12-05 22:39:16 +02:00
Pasi Kallinen
6e0a9cad5a Fake leash object is not attached
When farlooking at a fake leash object, make it explicitly not
be attached to a monster.
2018-12-05 22:36:03 +02:00
PatR
95a6c458bc fix #H6292 - green slime & genocide
Report suggested that if hero is turning into green slime, genociding
green slime should cure it.  I went another direction:  if life-saved
while dying due to turning into green slime, you survive polymorphed
into green slime form.  If green slimes have been genocided (probably
after becoming infected with slime or hero wouldn't have faced any
slimes to cause infection, but that could be from eating a glob of
green slime created prior to genocide, or from #wizintrinsic), you'll
immediately die again, this time from genocide.
2018-12-05 01:45:16 -08:00
nhmall
37b7243c57 some updates to curses
Tangles updates
2018-12-04 22:22:43 -05:00
nhmall
8fc308637b Merge branch 'NetHack-3.6.2-beta01' into macosx-minor 2018-12-04 21:39:16 -05:00
PatR
36c2aec2ff fix #H7667 - maybe_reset_pick(), other bad context
When deciding whether to discard interrupted lock/unlock context while
changing levels, maybe_reset_pick() checks whether xlock.box is being
carried.  But it was doing so after the old level had been saved and
memory for non-carried container there had been freed.

That led to a couple of other issues.  context.travelcc was using -1
for 'no cached value', but the fields of travelcc have type 'xchar' and
shouldn't be given negative values.  0 should be fine for 'no cache'.

Failed partial restore which occurred after old game's context had been
loaded would begin a new game with old game's stale context.  Restoring
goes out of its way to avoid that for 'flags' but didn't for 'context'.
2018-12-04 17:10:15 -08:00
nhmall
dc2539701a Revert "some fixes provided from Hardfought"
This reverts commit ab9e28d1aa.
2018-12-04 11:59:41 -05:00
nhmall
ab9e28d1aa some fixes provided from Hardfought 2018-12-04 11:58:05 -05:00
nhmall
f6b7ce02d8 Merge branch 'NetHack-3.6.2-beta01' of https://rodney.nethack.org:20040/git/NHsource into NetHack-3.6.2-beta01 2018-12-04 11:46:19 -05:00
nhmall
ec8f002d81 bit-use collision on WC2_TERM_SIZE, WC2_RESET_STATUS 2018-12-04 11:45:41 -05:00
PatR
285023acf6 fix #H7659 - accessing freed memory by cutworm()
hmon() can destroy the weapon being used, and known_hitum() would
still pass the pointer to the freed object to cutworm().  Remember the
relevant weapon attribute before using and maybe freeing the object,
then pass that attribute instead of the whole weapon.  Also pass
'more-likely-to-cut' for axes in addition to blades.

thimonst() behaved similarly, although due to much different code
paths none of the objects that might get to hmon() were then passed to
cutworm(), so it wasn't vulnerable.  But pass 'more-likely-to-cut'
for axes instead of for blades when thrown.
2018-12-03 18:57:01 -08:00
PatR
f2195c1212 more !SHELL, !SUSPEND
Update tty command completion to ignore #shell and #suspend when
they're disabled.  (Since they aren't flagged for command completion,
this should be unnoticeable.)

Update X11 extended command selection to not show shell and suspend
in the menu when they're disabled.  (Trickier than I expected.)

X11 currently rejects #suspend (at run time, not compile time) but
allows #shell.  If it was launched syncronously from a terminal
window, shell escape behaves sanely.  Otherwise, that seems like
asking for trouble.
2018-12-03 01:46:01 -08:00
Bart House
06fba14091 Merge branch 'win-minor' of https://rodney.nethack.org:20040/git/NHsource into win-minor 2018-12-02 20:23:03 -08:00
Bart House
f081e53876 Fix for NetHackW.exe menu icon rendering. 2018-12-02 20:22:47 -08:00
nhmall
5d9c172497 Merge branch 'win-minor' into NetHack-3.6.2-beta01 2018-12-02 21:26:54 -05:00
Bart House
92612b8f0c Added some missing header files to VS2017 NetHackW project. 2018-12-02 18:15:02 -08:00
Bart House
f3dcdc7fda Splash dialog and main window handle dpi change notifications. 2018-12-02 18:09:34 -08:00
PatR
13ef86488a command handling for !SHELL and !SUSPEND
Change the command list to always include #shell and #suspend so that
a user's preferred key bindings can span platforms without worrying
about whether those exist or not.  They're still effectively no-ops
when compiled out.

'#?' suppresses them from the list of displayed commands.  Interface-
specific extended command handling may want to check new extcmd.flag
value CMD_NOT_AVAILABLE to do the same, but failing to do so shouldn't
pose a problem.  They behave sanely if executed when not supported.
2018-12-02 16:43:53 -08:00
nhmall
7e9bc20c3a Merge branch 'win-minor' into NetHack-3.6.2-beta01 2018-12-02 19:42:12 -05:00
nhmall
6fe706f274 'curses_display_nhmenu' should return a value
Caught by automated build test

../win/curses/cursdial.c:598:9: error: non-void function 'curses_display_nhmenu' should return a value [-Wreturn-type]
        return;
        ^
../win/curses/cursdial.c:605:9: error: non-void function 'curses_display_nhmenu' should return a value [-Wreturn-type]
        return;
2018-12-02 18:47:23 -05:00
Bart House
796bdce828 Update comment within mswin_status_string. 2018-12-02 13:35:48 -08:00
Bart House
6ee48481b1 Respect BL_FLUSH and BL_RESET indications to mswin_status_update. 2018-12-02 13:33:07 -08:00
Bart House
0f679b3109 NetHackW status hilite support improved to include support for attributes. 2018-12-02 13:25:03 -08:00
nhmall
a9ff2a296a remove slipped-in partial bits from another feature
Some bits from another feature by Tangles had
slipped into our merge of curses a while back.

Remove the partial bits as feature bits should
be complete or not at all, unless foundational
for something to come.
2018-12-02 11:54:42 -05:00
Tangles
7c025fc344 curses - reinstate guicolors 2018-12-02 11:22:54 -05:00
Tangles
c3ecb5c43d curses - don't use popup for count selection.
There are issues with dismissing the popup afterwards.  These
were not really investigated as a count-selection doesn't really
warrant a popup anyway.
2018-12-02 11:20:46 -05:00
Tangles
2af7a74b7d curses - fix hero turning into # when selecting a count of items.
Why was that line in there anyway?
2018-12-02 11:20:21 -05:00