Commit Graph

13167 Commits

Author SHA1 Message Date
nhkeni
3cc0043dfe Fix dlb_main type issues. 2022-03-17 18:12:40 -04:00
nhkeni
7dba4f1236 Add FITSint() and FITSuint(),
which cast long long to int while panicking on overflow
2022-03-17 18:10:38 -04:00
nhkeni
e2d5013e01 Typedef getloc_flags_t for struct unpacked_coord.getloc_flags and related. 2022-03-17 17:17:13 -04:00
nhkeni
fc5e991b06 Add typedef mmflags_t to assure enough bits for all MM_* flags. 2022-03-17 17:14:12 -04:00
nhkeni
f8830e69e2 Merge branch 'NetHack-3.7' of https://rodney.nethack.org:20040/git/NHsource into NetHack-3.7 2022-03-17 16:57:31 -04:00
nhkeni
e260403f3b Guard variable used only with SYSCF_FILE. 2022-03-17 16:56:59 -04:00
nhkeni
9f3063df01 Make pointer differenace a long. 2022-03-17 16:56:25 -04:00
nhkeni
7a790c2a30 Use lua_Integer when interfacing with lua. 2022-03-17 16:30:16 -04:00
PatR
f24a12dfa1 choosing 'menustyle'
When using 'O' to set the menustyle option, include a description of
each of the styles.  Makes the menu entries two lines of two columns
each:  first line contains the setting value and the first half of
its description; second line has blank left column and second half
of description in the right one.  Value on first line and single-line
description on second would have been simpler but this seems easier
to read--the four possible values don't have any clutter between them.

Also, mark the current value as pre-selected.
2022-03-17 11:33:29 -07:00
nhkeni
1151d54500 Add and use Strlen(), like strlen() but panics on unreasonably long strings. 2022-03-16 21:42:00 -04:00
nhkeni
ff1289e828 Add Strlen(), a strlen(3) that panics if string is stupid long and returns unsigned.
First batch of changes to use it to suppress warnings.
2022-03-16 21:34:21 -04:00
nhkeni
1e31fee0df Don't infringe on POSIX typedef namespace. 2022-03-16 21:31:26 -04:00
nhkeni
3e4ea0a2c3 Merge branch 'NetHack-3.7' of https://rodney.nethack.org:20040/git/NHsource into NetHack-3.7 2022-03-16 21:27:22 -04:00
nhkeni
b444085d38 ssize_t for Windows 2022-03-16 21:27:06 -04:00
PatR
df58dc30b9 tty: count for group accelerators
github issue #697 from copperwater points out that using a menu for
pickup and attempting to give a count to pickup a subset of gold was
ignoring the count and picking up all gold.  That was an unintended
side-effect of making '$' be a group accelerator for gold in addition
to being the 'letter' for a stack of gold (so that it can be chosen
even when not displayed on the current page, the way other groups
behave).

Picking groups via their accelerator ignored any pending count (in
tty; curses seems to apply the count).  Change tty to apply a pending
count to all menu entries that get toggled on via group accelerator.
It's intended to address the gold bug but might also be used to
select one from every potion stack via '1!', for example.  (Seems to
be of very limited functionality, but that was more straightforward
than singling out gold's group to behave differently.)

While in there, change how tty uses menuitem_invert_test():  call it
for set-page/set-all/unset-page/unset-all in addition to existing
invert-page/invert-all.  unset-page/unset-all won't actually be
affected unless 'menuinvertmode' option is set to 2.

Closes #697
2022-03-16 17:03:52 -07:00
PatR
5db6dac863 menuinvertmode
Change the 'menuinvertmode' default from 0 to 1 so that it gets more
exercise.  It can be changed back to 0 via option settings but it's
doubtful that anyone will care enough to bother.

Some pickup/take-off actions have been using it to avoid setting
their 'all' choice when bulk toggling for current-page or whole-menu
takes place; 'O' specifies it for its '?' help choice.  This adds
the skipinvert flag to the 'all' choice of #wizidentify.

The comments describing it now state that menuinvertmode applies to
bulk set-on operations as well as to toggle-on/off operations but
that will only be true if/when interfaces call menuitem_invert_test()
for set as well as for invert.  tty is about to start doing that.
2022-03-16 16:19:30 -07:00
nhkeni
7f484815e5 Add streq() and start finding places it fixes warnings.
Some type fixes from Michael Allison.
2022-03-16 18:50:17 -04:00
nhkeni
dc72e07a2b Make readLenType generally available. Fix some warnings around read(2). 2022-03-16 18:41:45 -04:00
nhkeni
a64a666f78 Various type and cast bits. 2022-03-16 18:18:52 -04:00
nhkeni
e51026aee1 LIMIT_TO_RANGE_INT macro and various casts. 2022-03-16 17:59:23 -04:00
nhkeni
81b014977d Some easy loss-of-precision fixes. 2022-03-16 17:49:29 -04:00
nhkeni
16ea5e7fa6 cmdcount_t
Add a type to force g.{command_count,last_command_count,multi} to have the
same type (because cmd.c: g.multi = g.command_count;) and some resulting
cleanup.
2022-03-16 17:33:44 -04:00
nhkeni
ab16cf83b1 Merge branch 'NetHack-3.7' of https://rodney.nethack.org:20040/git/NHsource into NetHack-3.7 2022-03-16 17:22:43 -04:00
nhkeni
3aed0c61bc xcode cleanup:
don't use git (so tarball distribution should work)
 name the build shell scripts
2022-03-16 17:03:54 -04:00
nhkeni
41203982be Fix xcode recover install 2022-03-16 15:06:55 -04:00
nhkeni
0b4fad3cb7 NetHack.xcodeproj: update handling of Lua 2022-03-16 15:05:19 -04:00
Pasi Kallinen
074476758c Change map terrain changing from macro to function
The function handles setting lava lit, and removing ice melt timers.
2022-03-16 20:59:58 +02:00
Pasi Kallinen
811299edaf Lua: allow calling impossible 2022-03-16 16:58:42 +02:00
Pasi Kallinen
d1ca594d1c Remove melting ice timeouts when terrain changes
If special level lua code creates a melting ice timeout, but
later in the code places stairs, or a trap which might change
the ice to room floor, the timer sanity checking doesn't
like that.
2022-03-16 16:51:53 +02:00
Pasi Kallinen
49b26dbe99 Simplify abscoord code
No need to call get_location_coord, as we're never dealing with
random coordinates or rooms.
2022-03-16 16:46:10 +02:00
Pasi Kallinen
d76cf9377d Unhide monster when rolling boulder explodes 2022-03-16 16:43:42 +02:00
Michael Meyer
c6363d74a7 Fix: levitating/flying monsters moving over liquid
Commit c1a6dd4 was meant to prevent flying, levitating, and clinging
monsters from considering walls of water as acceptable movement
destinations, even outside of the Plane of Water.  However, it was
evaluating the monster's starting position instead of possible places to
move to, and the evaluation was 'backwards' (the equivalent of
IS_WATERWALL, instead of !IS_WATERWALL).

The result was that non-swimming monsters could only move onto any kind
of water or lava square if the position they were moving from was a
WATER square.  Change this so that instead of the starting position,
each potential destination spot's status as a wall of water is evaluated
in turn, and reverse the effect of the test so that it blocks walls of
water instead of allowing them.
2022-03-16 07:39:52 +02:00
Pasi Kallinen
38924002e0 Lua: ice theme room and melting ice
Allow the ice theme room to occasionally have melting ice.
Add nh.abscoord() to convert room-relative to map-absolute coords.
2022-03-15 22:05:36 +02:00
Pasi Kallinen
bdc81ab389 Lua: allow obj chain iteration 2022-03-15 18:24:49 +02:00
Pasi Kallinen
e33dd11e99 Document the lua object class 2022-03-15 14:17:46 +02:00
Pasi Kallinen
957c0fbee0 Lua: location-specific timers
Expose map-location specific timers to lua scripts. For example:

  nh.start_timer_at(x,y, "melt-ice", 10);

Currently only available timer type is "melt-ice".
2022-03-15 13:46:56 +02:00
Pasi Kallinen
006ae67029 Fix autowielding tools taking no time
When applying some tools (whips, polearms, grapples), or rubbing
a lamp, or when fireassist is on and you fire something without
wielded launcher, the automatic wielding should take as much time
as wielding the item normally does.

Fixes #696
2022-03-15 11:34:48 +02:00
copperwater
cc04bf9d8f Fix selection "random" grow direction, and other code cleanup
Noticed that when I set a selection to grow in a random direction, it
instead grew in all directions, which is not what I wanted. Turns out
the -1 random dir ended up being passed straight to the code which
checks bitmasks, without any form of randomizing among directions.

So this adds code to do that, and defines W_RANDOM as -1 rather than
using a magic number. In the process I also noticed that specifying
"random" as the wall for a door in a room made it rerandomize the
direction every iteration of its loop, essentially rolling two rn2(4)s
and only proceeding if they matched. That was pointless so I cleaned it
up a bit.

Also added safety checks in the form of an impossible for des.corridor()
being called with "random" as either walldir, because this is not
implemented currently.

And lastly, I noticed that create_secret_door was entirely unused
(secret door creation is handled in create_door), so I deleted it.

The only behavior change caused by this is that the Valkyrie quest lava
pools will be a little smaller, which is the only place grow is
currently used. If it's desired to keep them the same, that should be
changed to "all".
2022-03-15 07:44:56 +02:00
copperwater
1483778e96 Reduce eucalyptus leaf nutrition to 1
Eucalyptus leaves are famously inedible except by certain animals such
as koalas. I consider it very strange that a single leaf in NetHack
gives you six meatballs' worth of calories.

I considered making it 0 nutrition, but am not sure if a 0-nutrition
comestible would end up violating some assumption that all food is at
least 1 nutrition.
2022-03-15 07:41:53 +02:00
Pasi Kallinen
b271826147 Add test for selection subtraction 2022-03-14 19:06:51 +02:00
copperwater
b4a460f81b Implement selection addition and difference
Selection difference is something I have found myself wanting a lot when
working on levels, and have had to defer to a clunkier xor-then-and
approach. This commit implements the TODO-ed addition and subtraction
operators on two sets.

I don't see how the addition operator would be any different from
logical or, so it just calls l_selection_or rather than implement a new
function.
2022-03-14 18:42:28 +02:00
copperwater
a61a97856b Externify trycall() and replace many docall() calls with it
trycall() is a short docall() wrapper that is a no-op if the item is
already identified or the player has called the object type already. For
some reason, many calls to docall() did those same exact checks
beforehand.

This commit eliminates that redundancy by converting those calls into
trycall(), which is now made extern rather than local to do.c. No
behavior should be changed by this commit; I've checked that none of the
affected places could take a different code path now that the
oc_name_known and oc_uname checks are removed.
2022-03-14 09:48:19 -04:00
Pasi Kallinen
9dd69f4b88 Fix potentially uninitialized variables 2022-03-14 10:06:23 +02:00
nhmall
a61586153f Windows nmake build - separate x86 and x64 objs 2022-03-13 21:17:08 -04:00
PatR
de02301b45 revise a couple of recent changes
include/.gitignore should continue to ignore old files in case
someone checks out an older version, builds, then checks out the
current version without running 'make spotless' first.

sys/unix/Makefile.utl:  tiletxt.o depends on tilemap.c in addition
to tiletxt.c.
2022-03-13 13:58:56 -07:00
Pasi Kallinen
39f3988f76 Lua: object bury method 2022-03-13 18:38:23 +02:00
nhmall
439087ec6d remove a commented out test line from Makefile.utl 2022-03-13 11:37:00 -04:00
nhw_cron
c4593ac861 This is cron-daily v1-Feb-22-2022. 000files updated: Files 2022-03-13 11:26:15 -04:00
nhmall
c7b63d5ef9 follow-up: missed one include/tile.h 2022-03-13 11:24:19 -04:00
nhmall
a7e83696bd update include/.gitinfo 2022-03-13 11:17:58 -04:00