Commit Graph

14113 Commits

Author SHA1 Message Date
nhmall
1c177dcb39 a couple of inconsistencies
make pmatchregex regex_error_desc return type match cppregex.cpp and
posixregex.c

make the extern declaration for loadsyms[] in options.c match the
one in symbols.c.
2022-09-14 20:23:48 -04:00
PatR
c2a9343367 horn_of_plenty-to-container #tip
For tipping purposes, a horn of plenty is treated like a container.
But using one as the source container in a container-to-container tip
wasn't supported.  Implement that.

Also, #tip was offering carried bags of tricks as candidate containers
to tip some other carried container into.  Only do that for ones which
aren't known to be bags of tricks (so when type not discovered yet, or
specific bag not seen yet due to blindness).
2022-09-14 15:54:24 -07:00
nhmall
970a263d90 Merge branch 'pr873' into NetHack-3.7 2022-09-13 23:06:52 -04:00
nhmall
3951b4dc2a Merge branch 'vga-fixes' of https://github.com/chasonr/NetHack into pr873 2022-09-13 23:05:59 -04:00
Ray Chason
686153f6cb Sundry fixes for DOS 16-color VGA mode
To test 16-color mode, specify OPTIONS=video:vga explicitly;
autodetect will choose a VESA mode if it can.

* Draw tiles correctly when redrawing from panning or from changing
  the map mode among text, tiles and overview. Previously, this would
  draw everything with the tile at the hero's position.

* Draw corridor walls with the stone tile.

* Map the statue colors to the nearest neutral tone among the main
  16 colors. This mainly affects altars and female cats.

* Fix the code that shows statues as the generic statue tile. This
  code could be deleted, but the statues don't draw with the full
  range of gray tones.

* Document the option OPTIONS=video:vesa.
2022-09-13 19:49:56 -04:00
PatR
94945a719a onefile: isaac64.c <math.h> vs yn()
isaac64.c includes <math.h>.  yn() is a non-STDC math function in
<math.h> and that conflicts with nethack's yn() macro or vice versa.

If other source files begin using <math.h> this will probably need
to be handled differently.
2022-09-13 13:59:24 -07:00
PatR
bac60d21a5 onefile: 'here'
extralev.c's 'here' macro was interferring with subsequent uses of
'here' in code from other files.
2022-09-13 10:52:15 -07:00
PatR
a1e83d1d3a forward declarations for struct monst, struct obj
This should eliminate the 'onefile' complaint for objects.c without
breaking anything with any standard conforming compiler.  (Fingers
crossed.)
2022-09-13 10:27:53 -07:00
PatR
d0ee89ab68 container-to-container #tip typo
When tipping a magic-bag exploder from a sack or box into a bag of
holding, the choice of whether to call useup() or useupf() was
backwards.  But nothing bad happened which is fishy.
2022-09-13 04:28:49 -07:00
Pasi Kallinen
99e45e6daa Allow suppressing debugfuzzer warnings 2022-09-13 13:41:27 +03:00
PatR
7ae4efb07c fix issue #872 - container-to-container #tip
Reported by k2:  tipping one container's contents directly into
another container allowed transferring a wand of cancellation (not
mentioned:  or a bag of holding or a bag of tricks) into a bag of
holding without blowing it up.

That's now fixed.  There are other issues that this doesn't touch:

I think it's odd that you can transfer stuff from one carried
container to another but not from a carried container to a floor
container nor from one floor container to another one at same spot.

I didn't test shop billing so an not sure what happens when #tip
blows up a bag of holding and there are some unpaid items involved.

Using #tip on horn of plenty treats it like a container, but doing
that when it's carried doesn't offer the chance to tip its contents
directly into a carried container.

Tipping a carried container does not require free hands or even
limbs (for playability) but tipping such into another container
should require at least one free hand.

Fixes #872
2022-09-12 14:17:22 -07:00
nhmall
356e3176bc MacOS msdos compiler fetch script bit 2022-09-11 19:33:56 -04:00
PatR
ed8d81baa5 fix an options.c FIXME
Renaming got_from_config[] (something that was done in the past)
to set_in_config[] (something to do in the future) is sufficient to
remove any confusion about why it is being set from 'O'.  Since that
is the name of an enum value, use opt_set_in_config[] instead.
2022-09-11 13:15:39 -07:00
Pasi Kallinen
d7abdb96c4 More damageum return values 2022-09-11 21:52:46 +03:00
Pasi Kallinen
a3ba958728 Use define in damageum return value check 2022-09-11 21:30:54 +03:00
nhmall
6676959f5b comment and declaration is outdated
It looks like quite a lot of time has passed since this was accurate.
2022-09-11 09:08:35 -04:00
PatR
f4210542f0 enc_stat[], hu_stat[]
The definition of enc_stat[] got changed by a pull request nearly a
year ago ('const char *enc_stat[]' -> 'const char *const enc_stat[]')
but the separate declarations for it weren't changed to match.

Make the same change for hu_stat[].  Not sure why the pull request
didn't include it since the old declaration and the usage are same.

The curses one is in code that isn't used.
2022-09-10 19:30:36 -07:00
PatR
1df88e4c65 fix #H3820 - vault guard's "I repeat" message
Reported seven and a half years ago:  if you are in a vault but not
carrying any gold and the guard arrives, you're told "Follow me."
Then if you pick up gold while the guard is still in the wall breach
rather than out in the corridor, you would be told "I repeat, drop
that gold and follow me!"  "Repeat" refers to the follow part but
sounds as if it refers to the drop-gold part which isn't actually
being repeated.  Keep track of whether the guard has issued a drop
gold demand and use that to vary the wording of subsequent "I repeat"
message.

Modifies monst->mextra->egd so save and bones files are invalidated.
2022-09-09 11:45:30 -07:00
Pasi Kallinen
a733004912 Remove the per dungeon level door limit
Number of doors in a room-and-corridor style level was fixed
at 120; now the doors-array is dynamically allocated when needed.

Breaks saves and bones.
2022-09-09 19:40:45 +03:00
nhmall
c6a8519fec Guidebook update 2022-09-09 10:16:45 -04:00
Pasi Kallinen
82867ccdaf Fix traps generated inside walls
When fuzzing, noticed a trap generated inside a wall. Culprit
was one of the themed rooms that generates a rectangular room and then
puts freestanding wall columns inside.  Note in somexy that it can
return a non-accessible location, and change the places that used
it and absolutely needed a space to somexyspace.
2022-09-09 12:03:12 +03:00
PatR
3ee6bcdf76 doset_simple() revisited
For a compound option's value that uses getlin(), cancelling with
ESC wasn't dismissing the menu and could eventually result in a
"No window slots!" panic.  Clean up properly after ESC.

doset() and doset_simple() were sharing a format string but those
weren't the same if the longest option name differed.  Stop sharing.

doset_simple() didn't support menu_tab_sep.  Now it does.  (Tested
with Qt; really needs to be tested with WinGUI.  Enabling that is
expected to produce strange looking results with tty or curses.)
2022-09-08 16:26:31 -07:00
nhmall
a4c4e75467 a couple of warnings in files.c
Warning	C6031	Return value ignored: 'rename'.	src/files.c	1240
Warning	C6031	Return value ignored: 'write'.	src/files.c	3879
2022-09-08 12:31:36 -04:00
PatR
1c90965555 Passes_walls
While testing the secret door message handling, I wanted to phaze
through solid rock to get near some secret corridors.  Instead of
polymorphing into a xorn, I used #wizintrinsic to get temporary pass
through walls.  That let me move orthogonally through rock but not
diagonally.  Polymorph to xorn did allow diagonal movement.  I think
the difference was gaining 18/100 strength in that form.

Have wall phazing override narrow diagonal checks.
2022-09-08 09:18:43 -07:00
nhmall
cebc9e9416 fix a grammar bit adjacent to recent spelling fix 2022-09-08 12:08:37 -04:00
PatR
097d225994 secret door detection feedback
When zapping a wand of secret door detection or casting spell of
detect unseem instead of displaying
|You reveal secret doors.
|You reveal a secret corridor.
|You reveal traps.
|You reveal a hidden monster.
show
|You reveal 2 secret doors, a secret corridor, 3 traps, and a hidden monster.
as a single message.

Detecting invisible monsters is still a separate message; those get
re-mapped as "remembered, unseen monster" but not actually revealed.
2022-09-08 08:53:02 -07:00
nhmall
c548fff9e4 some spelling corrections
The pull request included some changes that were neither accidental nor
unintentional, so only a subset of the changes from pull request #869
submitted by klorpa were manually applied.

behaviour  -> behavior
speach     -> speech
knowlege   -> knowledge
incrments  -> increments
stethscope -> stethoscope
staiway    -> stairway
arifact    -> artifact
extracing  -> extracting

The uses of "iff" were left alone.

Close #869
2022-09-08 10:54:11 -04:00
Patric Mueller
7a90cd3608 Document italic for menu headings and menu colors 2022-09-08 12:39:02 +02:00
Patric Mueller
487f1f7ccc room stocking would put multiple items on the same spot 2022-09-08 09:24:50 +02:00
PatR
fa320a0a5f doset_simple()
Move the guts of doset_simple() into a separate routine.  Initially
that was just to avoid having to increase indentation when replacing
'goto' with 'do { ... } until ()'.  It ends up making the flow of
control easier to see.

doset() and doset_simple() each had their own static flag indicating
whether 'fmtstr_doset' had been assigned a value.  Redundant
assignment produced the same value so it wasn't an actual problem.

doset_simple() probably needs to add menu_tab_sep support for WinGUI.
Qt is able to get by without it, but that's because it forces use of
fixed-width font when any line in a menu or text window has 4 or more
consecutive spaces.  I don't think WinGUI does that.
2022-09-07 14:37:08 -07:00
nhmall
feebb561d6 redundant comparison code watchman_canseeu()
m_canseeu() already includes couldsee() so redundant code was flagged.

: #define m_canseeu(m) \
:     ((!Invis || perceives((m)->data))                      \
:      && !Underwater                                        \
:      && couldsee((m)->mx, (m)->my))

static boolean
watchman_canseeu(struct monst *mtmp)
{
    if (is_watch(mtmp->data) && mtmp->mcansee && m_canseeu(mtmp)
        && couldsee(mtmp->mx, mtmp->my) && mtmp->mpeaceful)
        return TRUE;
    return FALSE;
}
2022-09-07 07:52:33 -04:00
Pasi Kallinen
e952f67f2c Add #wizcast command to cast any spell
Wizard-mode command to cast any spell without checks that would
prevent casting, and with no energy use.

Mainly to allow the fuzzer to exercise the spell code paths.
2022-09-06 22:58:28 +03:00
nhmall
4f2996758b follow-up 2022-09-06 10:12:19 -04:00
nhmall
0086e01967 return legal indexes for some display.h macros
Some static analyzers flagged the last-resort values as
out of bounds (which they were).

There's a small number of other complaint-suppression items in here too,
but nothing drastic.
2022-09-06 10:00:07 -04:00
nhmall
817b4686ce Revert "move struct propname to a header file"
This reverts commit 402b2bf5c8.
2022-09-06 08:01:50 -04:00
nhmall
402b2bf5c8 move struct propname to a header file
In doing so, avoid repeated layout declaration in cmd.c
2022-09-06 07:22:55 -04:00
PatR
1459f44f4e \#herecmdmenu tweak
The menu for #herecmdmenu includes "look at map symbol" but if you
choose that it auto-picks the hero's location.  Looking at your own
'@' isn't particularly useful so only include that menu option if
the symbol or tile being displayed isn't the normal one.
2022-09-05 14:58:55 -07:00
PatR
4aefe3dae0 curses A_ITALIC build fix
My /usr/include/curses.h has various A_attribute macros but A_ITALIC
isn't one of them.  Compiling cursmisc.c failed because one of the
uses of that wasn't guarded by #ifdef A_ITALIC.  Instead of adding the
ommitted #if, substitute A_UNDERLINE for A_ITALIC when that's missing.

The select attribute menu when adding a menu color or a status hilite
now shows an entry for italic that's underlined (as expected) but the
underline entry itself does not display any sort of attribute.  I
didn't pursue that.
2022-09-05 14:40:41 -07:00
Pasi Kallinen
e818395a55 Add tipping a container to herecmdmenu 2022-09-05 23:27:58 +03:00
nhmall
c825e6839f redundant comparison code
: #define is_weptool(o) \
:    ((o)->oclass == TOOL_CLASS && objects[(o)->otyp].oc_skill != P_NONE)
2022-09-05 11:16:43 -04:00
Pasi Kallinen
f58f43bd78 Cannot kick while squeezed on top of a boulder 2022-09-05 11:21:19 +03:00
Patric Mueller
8bf5654eed tty and curses: support italic as text attribute 2022-09-04 22:33:25 +02:00
Pasi Kallinen
601dba5279 Make glorkums emit impossible 2022-09-04 17:43:06 +03:00
PatR
82aaa289ef discarding migrating objects when entering endgame
Avoid potential impossible "obfree: deleting worn object" warnings
when entering the endgame.

The code to get rid of items migrating to non-endgame levels passes
those items to obfree().  It needs to clear obj->owornmask first
because that's used for migration flags (undelivered orctown loot
has a non-zero value).
2022-09-03 10:45:24 -07:00
Pasi Kallinen
f5a9901db1 Special levels: mkmap roomno cleanup and room removal after map
mkmap creates mines-style full-level maps, so it should wipe
out all the room numbers in the level away. Also, it uses
temporary rooms for making sure the map is fully joined together;
those temporary rooms were left on the map, but should've
been cleared away.

When putting down map-parts on the level, don't remove the room
data which would be under that map; the map may have holes in them
(using the "x" map char), so a room may still exist there.
I don't think it matters if there is any room data which doesn't
have any room numbers referring to it in the level.
(Usually the special levels use map right after level_init anyway,
so there wouldn't be any rooms in the level)
2022-09-03 19:10:45 +03:00
PatR
7100534c80 typo fix and comment update for #migratemons 2022-09-01 13:36:50 -07:00
copperwater
82782a1d6d Make des.mineralize use default probabilities
Calling des.mineralize() with no arguments was equivalent to calling it
and manually specifying gem_prob = 0, gold_prob = 0, etc. Which meant
that no mineralization would actually happen.

Instead, make this match the intuitive behavior, and pass in -1
probabilities as defaults -- which the mineralize() function interprets
as the caller wanting to use the standard probabilities for a level of
that depth, as if it were not a special level.

This change does not affect any special level files since des.mineralize
is not currently used in any of them.
2022-09-01 17:15:36 +03:00
copperwater
d8ada3d768 Fix inaccessible spaces and shop backdoors in Bustling Town
Perennial problem: since Bustling Town consists of a fixed map which was
shorter than the moveable area overlaid onto a cavern fill, sometimes
the cavern fill made spaces above or below the walled edges of the town,
which then got cut off when the town was placed. Since one of the valid
ways to generate a way out of an inaccessible space is to create a door
connecting it to an accessible space, this meant rooms in Minetown,
including shops, could get a second door leading into that tiny space.
And if it was a shop, the shopkeeper could not block exit from the
second door.

This fixes that issue by expanding the map vertically so that it will
overwrite the whole cavern fill in the town area of the map segment
where it might create cut-off spaces like this. (Not the whole area -
since we now have the 'x' mapchar to leave existing terrain in place,
areas adjoining open space where inaccessible pockets won't get
created can retain any existing fill to keep the town from being exactly
the same every time).
2022-09-01 17:11:50 +03:00
Pasi Kallinen
c447d091b1 Fixes entry 2022-09-01 17:09:26 +03:00
Michael Meyer
51d568319b Use const char * for read_simplemail 'mbox' param
Nothing about read_simplemail is incompatible with using const, and the
lack of const required some contortions (copying ADMIN_SERVER_MSG to
another buffer with nonconst() to prevent a compiler warning).

This was the last place nonconst() was used, so I removed it.
2022-09-01 17:02:30 +03:00