Commit Graph
100 Commits
Author SHA1 Message Date
nhmall 995fae39b5 spurious warning with visual studio 2017
Don't force on a particular warning in the nmake Makefile if
compiling using the older visual studio 2017.

Resolves #950
2022-12-15 08:39:30 -05:00
nhmall 9dbb21cfcb update tested versions of Visual Studio 2022-12-14 2022-12-14 14:33:36 -05:00
nhmall 2ee061e02d cast away a new warning
role.c: In function 'plnamesuffix':
role.c:1615:19: warning: operand of '?:' changes signedness from 'int' to 'unsigned int'
due to unsignedness of other operand [-Wsign-compare]
1615 |                 ? (int) (eptr - gp.plname)
                         ^~~~~~~~~~~~~~~~~~~~~~~~

Since Strlen() (actually hacklib's Strlen_ function) returns 'unsigned' for the
second operand of the '?:', the compiler was having to change the signedness
of the first operand '(int) (eptr - gp.plname)' to 'unsigned' and issuing the
warning.

Cast the result of Strlen() to int to make both operands of the '?:' the same
('signed').
2022-12-13 19:17:00 -05:00
nhmall bc13b52d32 windconf.h mingw bit 2022-12-12 15:20:22 -05:00
nhmall 71c26361ff follow-up: make the ifdef logic a bit clearer 2022-12-12 14:37:40 -05:00
nhmall 9e91064659 makedefs temp files issue with mingw
The unlink call wasn't operating the same on a makedefs built
on mingw, and dat/mdXXXX files were being left behind post-build.

Provide an alternative way of doing the temporary files if
MD_USE_TMPFILE_S is defined during the compile of makedefs.c
2022-12-12 12:53:51 -05:00
nhmall 092068495b fixes update 2022-12-11 21:55:15 -05:00
nhmall 5ac96e9318 odd Windows lighting in lit rooms (issue #929)
bkglyph variable gets initialized to GLYPH_UNEXPLORED so ends
up being returned by get_bk_glyph() if something more interesting
wasn't chosen in the switch statement.

The Windows win32 interface will then use the tile mapped to
GLYPH_UNEXPLORED as a background. The tile is 16x16 all black
pixels. That looked very odd.

Treat GLYPH_UNEXPLORED as an out-of-range value.

Closes #929
2022-12-11 21:29:42 -05:00
nhmall 9e2effe710 Merge branch 'unicode-performance' of https://github.com/chasonr/NetHack into NetHack-3.7 2022-12-10 17:15:31 -05:00
nhmall 4c32ca571a doc update 2022-12-08 10:46:36 -05:00
nhmall 873d08b7bc fix Makefile rule when building pdcurses library
Also, use Bill Gray's pdcursesmod for now.
2022-12-07 21:23:14 -05:00
nhmall 3ac4e55f1f submodule update for pdcurses 2022-12-07 17:22:10 -05:00
nhmall d18ce24320 more continuation alignment after g to g? (.h) 2022-12-07 11:31:11 -05:00
nhmall 8120b74051 realign macro continuation after g to g? expansion 2022-12-07 11:24:17 -05:00
nhmall f61a862a47 paste error in Makefile.mingw32 2022-12-06 11:00:29 -05:00
nhmall 215808abd1 clear up a few gcc warnings 2022-12-05 23:19:38 -05:00
nhmall afef4bc781 issue with mingw resolved; resume mingw build in CI 2022-12-05 19:03:11 -05:00
nhmall b88ff70435 disable mingw build for now 2022-12-05 15:11:26 -05:00
nhmall 693e708228 yet another follow-up after CI report 2022-12-05 14:12:36 -05:00
nhmall 6d19d8ff1c another mingw follow-up after CI report 2022-12-05 14:07:33 -05:00
nhmall 883e4cbadd another mingw Makefile follow-up 2022-12-05 14:00:22 -05:00
nhmall 64f060bfa9 mingw Makefile updates 2022-12-05 13:54:09 -05:00
nhmall d4968e752e fix pair of prototype differences between date.c and mdlib.c 2022-12-05 13:39:46 -05:00
nhmall b86109e9fa Merge branch 'windows-makefile' into NetHack-3.7 2022-12-05 13:27:25 -05:00
nhmall 485797ee8c rework windows nmake file
Keep object files separate between gui and tty builds as they
are not the same binary on windows.

The stubs.c file will no longer be necessary.
2022-12-05 13:21:19 -05:00
nhmall 225af4ed4b CI ms-dos build: 1 warning was logged as 2 due to set -x 2022-12-02 00:23:46 -05:00
nhmall df0c65ce41 more fetch-cross-compiler.sh tweaks 2022-12-02 00:20:41 -05:00
nhmall cc231e47c0 exit on fetch-cross-compile failure, not proceed 2022-12-01 23:58:14 -05:00
nhmall 233e4a41af exit return code 2022-12-01 21:46:19 -05:00
nhmall a1cd77e39c in fetch-cross-compiler.sh, stop if required piece failed to download 2022-12-01 20:36:10 -05:00
nhmall 4ede5f1cd4 Use-after-free with engulfer in xkilled #938
If you were on a level teleporter, the spoteffects() call after
the hero gets expelled could end up going to a new level and
freeing all the monst chains from the level you were originally
engulfed on.

    #0 0xba0507 in free
    #1 0x87feda in dealloc_monst src/mon.c:2369
    #2 0x880a02 in dmonsfree src/mon.c:2194
    #3 0x9a7aa2 in savelev_core src/save.c:507
    #4 0x9a7a21 in savelev src/save.c:466
    #5 0x71eb9d in goto_level src/do.c:1483
    #6 0x71833f in deferred_goto src/do.c:1903
    #7 0xa2533f in level_tele src/teleport.c:1117
    #8 0xa2567b in level_tele_trap src/teleport.c:1198
    #9 0xa5c007 in trapeffect_level_telep src/trap.c:1861
    #10 0xa5f856 in trapeffect_selector src/trap.c:2497
    #11 0xa47497 in dotrap src/trap.c:2586
    #12 0x7d669b in spoteffects src/hack.c:2859
    #13 0x89d495 in xkilled src/mon.c:3187

The latter parts of xkilled() after the spoteffects() call would
then attempt to dereference the free'd monst pointer.

Save a copy of the monst struct prior to spoteffects() if you were
expelled, then point at the reference copy afterwards.

Resolves #938
2022-12-01 03:48:11 -05:00
nhmall cf1a46afa6 Merge branch 'cursed-gold-detection' of https://github.com/vultur-cadens/NetHack into NetHack-3.7 2022-11-30 23:18:09 -05:00
nhmall b4f97ff18c typo in README 2022-11-30 10:21:41 -05:00
nhmall 6b99a50821 fix a couple of ms-dos shadow declaration warnings 2022-11-29 23:43:42 -05:00
nhmall 02a48aa8cf split g into multiple structures
The consolidation of global variables from scattered source
files into decl.c and declared in decl.h was begun in 3.7.0.
Their placement in common files was done for centralized
initialization and potential re-initialization during a
"play again" scenario.

It wasn't really necessary for all of them to be housed in a
single huge structure to meet the "play again" requirement,
and the single huge structure has been a little unwieldy when
it comes to maintenance.

Following this commit, instead of one single extremely large structure
named 'g' to house all of the relocated global variables, they
are distributed into several ga through gz.

To make things easy for the developer, each variable is placed
into the struct corresponding to the starting letter of the variable.
That way, no lookup is required in order to know which struct houses
a particular variable, it is a simple match to the starting letter
for all the centralized global variables.

A global variable named 'amulets', would be found in ga.
    ga.amulets
     ^ ^
A global varable named 'move', would be found in gm.
    gm.moves
     ^ ^
A global variable named 'val_for_n_or_more' would be found in gv.
    gv.val_for_n_or_more
     ^ ^
A global variable named 'youmonst' would be found in gy.
    gy.youmonst
     ^ ^
2022-11-29 21:53:21 -05:00
nhmall 864d3c7638 fix a syntax error in Makefile.src 2022-11-26 17:03:53 -05:00
nhmall 4b04b1e6ac expand support for noreturn declarations
Although gcc specifies support for declaring a function as
noreturn after the function name and parameters, other compilers
do so via an attribute at the start of the declaration. Add some
macro support for the attribute-at-the-beginning method:
  o MS Visual Studio compiler
  o Upcoming C23 standard (untested at this point)
2022-11-24 00:51:42 -05:00
nhmall ddf1dfde29 quiet another warning that recently appeared
../win/curses/cursinit.c:102:9: warning: variable 'min_message_height' set but not used [-Wunused-but-set-variable]
    int min_message_height = 1;
        ^
1 warning generated.
2022-11-24 00:49:51 -05:00
nhmall 6ab7cafb25 quiet a warning that has appeared recently
botl.c:1303:25: warning: variable 'notpresent' set but not used [-Wunused-but-set-variable]
    int i, updated = 0, notpresent = 0;
                        ^
1 warning generated.
2022-11-23 23:34:47 -05:00
nhmall 3398b34cc7 another follow-up, don't cast hardcoded u.ux, u.uy 2022-11-23 19:10:28 -05:00
nhmall 9efa5d5b44 follow-up bit (in unused ms-dos code) 2022-11-23 18:57:14 -05:00
nhmall 937355038d some coordxy and other conversion warnings
When dist2() got changed to use coordxy parameters, a macro that uses
it in its definition was overlooked and it had (int) casts in it.
That caused a warning about possible data loss when the int
then got converted to coordxy for the dist2() call.

Give online2() coordxy parameters instead of int, like its bretheren.

Avoid a couple of implicit conversion warnings where ints were being assigned
to smaller uchar or ints being assigned to smaller short.

A couple of signed vs unsigned warnings on some rumor processing.

Avoid some signed vs unsigned warnings in mdlib/makedefs where a signed int
param eventually got used in an external call that took size_t.
Eliminate all of it by just having the outer NetHack routine also take
a size_t.

Lastly, insert some default C99 alternative time-related code
in mdlib/makedefs since asctime() and ctime() are being flagged as
deprecated in the upcoming C23 standard and will now start to trigger
warnings for anyone using a C23-compliant compiler.
2022-11-23 17:49:55 -05:00
nhmall 8badbc06d4 update tested versions of Visual Studio 2022-11-14 2022-11-14 12:57:21 -05:00
nhmall dcb1250ed6 move Makefile variable assignment 2022-11-14 00:22:32 -05:00
nhmall 0666a1c5da fix path to djgpp c++ compiler in ms-dos cross-compile 2022-11-14 00:00:20 -05:00
nhmall 583d124735 some follow-up for warnings experienced on macOS 2022-11-13 22:56:05 -05:00
nhmall 3f93d54b66 some Makefile and hints tinkering
1. remove all window interface bits from compiler.370, and have
   the preceding include files set some variables to control
   the behavior of compiler.370 when it comes to c++.
2. some more common Makefile lines into sys/unix/hints/include/multiw-3.370.
3. make it so you can pass cppregex=1 on the Make command line to build with
   sys/share/cppregex.cpp instead of posixregex.c
4. fix sys/share/cppregex.cpp so that it will build with clang compiler
   (required an additional header include). I don't know if it would have
   worked with g++ without that change. The include can be placed into an #ifdef
   block if there's an issue with the change on other compilers.
5. Anything that needs to compile using c++ (Qt, sys/share/cppregex.cpp) can
   just ensure that CPLUSPLUS_NEEDED Makefile variable is set above the lines
   in compiler.370 to ensure that things get set up for c++. It no longer
   checks specifically for Qt. That is what sys/unix/hints/include/multiw-2.370
   does now.
2022-11-13 22:25:07 -05:00
nhmall 21203c950e multiw-3.370
Add a 3rd multi-window include file that comes after compiler.370.

Relocate a small section of Makefile lines common to both macOS.370
and linux.370 to multiw-3.370.

Also relocate a section near the tail of compiler.370 that really
has nothing to do with compilers or compiler flags, but was
related to Qt which is one of the supported multi-window interfaces.
2022-11-13 12:17:27 -05:00
nhmall 9ef7135ccd typo 2022-11-10 12:22:13 -05:00
nhmall 6864e6cf22 add a note 2022-11-10 11:57:00 -05:00
nhmall 27e311b733 remove code on Windows referencing WIN32_GRAPHICS
As far as I know, there's no such thing as WIN32_GRAPHICS in the
current source tree. The Windows graphical port uses the preprocessor
macro MSWIN_GRAPHICS.
2022-11-10 11:47:31 -05:00
nhmall 88a0153a6e avoid use of variables near and far
Some recent testing with a multi-platform compiler encountered difficulty
with the use of a variable 'near' (and presumably 'far', but we don't have
any of those in the source tree) due to reserved word extensions.

Avoid using that as a variable name.
2022-11-10 11:18:49 -05:00
nhmall 9e92fefdd8 keep propertynames static in timeout.c 2022-11-06 10:02:27 -05:00
nhmall 38ff4029aa follow-up bit to fixes3-7-0.txt 2022-11-05 19:40:23 -04:00
nhmall 6b804c0e84 warning resolution
makedefs.c:100:6: warning: unused variable 'Dont_Edit_Code' [-Wunused-variable]
    *Dont_Edit_Code =
     ^
1 warning generated.
2022-11-05 19:36:46 -04:00
nhmall 993a82858b Merge branch 'old-software-compatibility' of https://github.com/chasonr/NetHack into NetHack-3.7 2022-11-05 19:30:20 -04:00
nhmall 76833d6f5e add fixes3-7-0.txt entry for pr923 2022-11-05 19:28:28 -04:00
nhmall e0f4ad405b Merge branch 'pr923' into NetHack-3.7 2022-11-05 19:26:50 -04:00
nhmall 779d0b2f20 Merge branch 'unicode-X11-2' of https://github.com/chasonr/NetHack into pr923 2022-11-05 19:23:18 -04:00
nhmall 185322421a relocate mstrength() and supporting function again
Also, purge the code for makedefs -m
2022-11-05 18:40:57 -04:00
nhmall 242c05ccf3 Revert "ranged_attk() - there can be only one"
This reverts commit b399e3f2f5.
2022-11-05 15:26:29 -04:00
nhmall b399e3f2f5 ranged_attk() - there can be only one
Relocate the newer code for the function to mdlib.c
where makedefs can still use it.
2022-11-05 13:07:10 -04:00
nhmall eeedff9478 prefix static version of ranged_attk() in mdlib.c 2022-11-05 12:38:02 -04:00
nhmall cf897d9293 prefix some macro names 2022-11-03 16:50:25 -04:00
nhmall d80e8d9569 adjust 4 line lengths from previous commit 2022-11-03 15:50:32 -04:00
nhmall fac75f5ae4 purge more E for extern 2022-11-03 15:42:24 -04:00
nhmall 39b9669725 transcription error 2022-11-01 12:58:09 -04:00
nhmall b4080cefcb more unnecessary #undef 2022-11-01 12:52:22 -04:00
nhmall 5192191e5d Qt: remove obsolete #undef lines 2022-11-01 12:46:10 -04:00
nhmall 068b8fde71 Merge branch 'fix-makedefs' of https://github.com/argrath/NetHack into NetHack-3.7 2022-10-31 14:20:10 -04:00
nhmall 694fea1076 omdump declaration
..\src\allmain.c(1061): warning C4221: nonstandard extension used: 'ed': cannot be initialized using address of automatic variable 'omdump'
..\src\allmain.c(1056): note: see declaration of 'omdump'

Resolves #916
2022-10-31 13:29:08 -04:00
nhmall ad23b4e8e1 grammar: "foo based" to "foo-based"
There seems to be a need to locate these in the distribution every decade or so.
2022-10-30 16:08:14 -04:00
nhmall 99a93fe50b some C99 changes
Instead of using index() macro defined to strchr, use C99 strchr.
Instead of using rindex() macro defined to strrchr, use C99 strrchr.

If you want to try building on a platform that doesn't offer those
two functions, these are available:
    define NOT_C99       /* to make some non-C99 code available */
    define NEED_INDEX    /* to define a macro for index()  */
    define NEED_RINDX    /* to define a macro for rindex() */
2022-10-29 10:54:25 -04:00
nhmall 943c1bc3c3 more OSX -> macOS 2022-10-29 10:46:14 -04:00
nhmall 1adfbd2594 fixes update for pr913 part 2 2022-10-29 10:43:58 -04:00
nhmall b445b99214 fixes entry for pr913 2022-10-29 10:38:29 -04:00
nhmall 91ce86326b Merge branch 'qt6-buttons' of https://github.com/chasonr/NetHack into NetHack-3.7 2022-10-29 10:33:37 -04:00
nhmall a51c983a13 Revert "PR913 - Another Qt 6 signal: mapped -> mappedString"
This reverts commit 57617da39b.
2022-10-29 10:33:17 -04:00
nhmall 2fef1f497c more Guidebook updates 2022-10-27 22:27:00 -04:00
nhmall ee03f5c2ba Merge branch 'showgold-guidebook-update' of https://github.com/entrez/NetHack into NetHack-3.7 2022-10-27 22:23:34 -04:00
nhmall 95adc9d661 Merge branch 'pr913' into NetHack-3.7 2022-10-27 22:15:00 -04:00
nhmall 1c0261a397 Merge branch 'qt6-buttons' of https://github.com/chasonr/NetHack into pr913 2022-10-27 22:14:13 -04:00
nhmall 8b89917ede be consistent for all patforms in fixes3-7-0.txt 2022-10-27 15:49:16 -04:00
nhmall 3cd99786f2 doc/Guidebook.txt update 2022-10-27 11:33:10 -04:00
nhmall c2df67b1f1 Guidebook date stamp 2022-10-27 10:47:03 -04:00
nhmall b70a3d198e add a fixes entry for pull request #910 2022-10-27 10:07:32 -04:00
nhmall bddaf28ea6 Merge branch 'unicode-Qt' of https://github.com/chasonr/NetHack into NetHack-3.7 2022-10-27 10:05:04 -04:00
nhmall 8c9d4de9ed Merge branch 'no-urace-in-is_foo' of https://github.com/entrez/NetHack into NetHack-3.7 2022-10-27 10:04:11 -04:00
nhmall 116f80e8f5 config.h band should have been left off prev 2022-10-26 14:28:29 -04:00
nhmall 88f6df2d8b some tabs to spaces
cd src
    grep -P -n '\t' *.c | grep -v "1:"
    cd ../include
    grep -P -n '\t' *.h | grep -v "1:"
    cd ..

side note: win/Qt/*.cpp are full of tabs
2022-10-26 14:21:23 -04:00
nhmall 1cf4f9f7f9 another README update 2022-10-26 10:34:22 -04:00
nhmall 8e2ccb3ccc another README update
macOS Ventura (macOS 13) was tested
- successful NetHack build
- game start/save/restore
2022-10-26 10:29:27 -04:00
nhmall faaea0c057 README update 2022-10-26 09:07:44 -04:00
nhmall 7f94d04013 fix warning when ENHANCED_SYMBOLS is not defined
display.c:1484:23: warning: excess elements in struct initializer [-Wexcess-initializers]
    { 0U, { 0, 0}, 0, 0 }
                      ^
1 warning generated.
2022-10-25 14:12:47 -04:00
nhmall fc6c524a5e Revert "fix warning when ENHANCED_SYMBOLS is not defined"
This reverts commit 88cc5246b4.
2022-10-25 14:08:17 -04:00
nhmall 88cc5246b4 fix warning when ENHANCED_SYMBOLS is not defined
display.c:1484:23: warning: excess elements in struct initializer [-Wexcess-initializers]
    { 0U, { 0, 0}, 0, 0 }
                      ^
1 warning generated.
2022-10-25 13:59:19 -04:00
nhmall e2bd3b6b55 warning fix
mhitm.c: In function 'hitmm':
mhitm.c:583:30: warning: '%s' directive writing between 8 and 9 bytes into a region of size between 0 and 255 [-Wformat-overflow=]
  583 |             Sprintf(buf, "%s %s", magr_name,
      |                              ^~
In file included from ../include/config.h:671,
                 from ../include/hack.h:10,
                 from mhitm.c:6:
../include/global.h:279:24: note: 'sprintf' output between 10 and 266 bytes into a destination of size 256
  279 | #define Sprintf (void) sprintf
mhitm.c:583:13: note: in expansion of macro 'Sprintf'
  583 |             Sprintf(buf, "%s %s", magr_name,
      |             ^~~~~~~
2022-10-24 09:14:35 -04:00
nhmall b40ef88e1e nmake warning
NMAKE : warning U4004: too many rules for target 'o\x86\cppregex.o'
2022-10-23 12:38:22 -04:00
nhmall 6f20939db9 support Unicode on Win32 pr #903 2022-10-23 12:34:16 -04:00
nhmall 6fd0bd3169 Merge branch 'unicode-win32' of https://github.com/chasonr/NetHack into NetHack-3.7 2022-10-23 12:32:04 -04:00