Commit Graph

4410 Commits

Author SHA1 Message Date
Bart House
96eae720ce Revert "Removed unnecessary use of static for nocreate values."
This reverts commit ff12c334af.
2018-11-22 12:15:13 -08:00
Bart House
ff12c334af Removed unnecessary use of static for nocreate values.
If multiple games are played without exiting the process, on the second
new player creation the nocreate values will already be set based
on the first player creation.
2018-11-22 10:15:43 -08:00
Pasi Kallinen
030efe84fa Map column 0 is not a valid location 2018-11-21 19:17:08 +02:00
PatR
2beb36fc61 Schroedinger's Cat
If hero was carrying Schroedinger's Box at end of game, disclosing
inventory converted it into an ordinary box.  That interferred with
subsequent disclosure when writing DUMPLOG, which saw an empty box
if inventory had been shown or the special box with newly-determined
contents if not.  I tried a couple of ways to fix it and decided
that redoing it was better in the long run.

Schroedinger's box is still flagged with box->spe = 1, but instead
of having that affect the box's weight, now there is always a cat
corpse in the box.  When opened, that will already be in place for
a dead cat or be discarded for a live one, but the weight will be
standard for container+contents and when box->cknown is set it will
always be "containing 1 item" (which might turn out to be a monster).

Some temporary code fixes up old save/bones files to stay compatible.

TODO:  food detection used to skip Schroedinger's Box; now it will
always find a corpse, so some fixup like the ridiculous probing code
is needed.
2018-11-21 03:10:49 -08:00
nhmall
03ef9da591 Merge branch 'macosx-curses-fall2018' into NetHack-3.6.2-beta01 2018-11-20 21:01:48 -05:00
PatR
50cb52ab31 sentence spacing
Use two spaces between sentences.  This only fixes the instances of
one-space that were fairly easy to find.
2018-11-20 17:56:16 -08:00
PatR
d15dacc44c fix #H7530 - corpse from corpseless monster
Migrating monster attempting to arrive on a level which is already
full of monsters gets killed off.  It was leaving a corpse without
regard for whether it was a type of of monster which should never
leave corpses.

I'd prefer that it be put back on the migrating_mons list rather
than be killed off, but this just suppresses impossible corpses.
2018-11-20 13:13:23 -08:00
Bart House
c987a3dc2f Added initialization of locals in create_room() to quite compiler warnings. 2018-11-20 10:30:11 -08:00
Bart House
a19b05d262 Added initialization of cc in do_look() to quite compiler warnings. 2018-11-20 10:29:05 -08:00
Bart House
d1cd20998f Added initialization if ilet to quite compiler warnings. 2018-11-20 10:27:35 -08:00
Bart House
7f4a4188a0 Added initialization of newlevel to quite compiler warnings. 2018-11-20 10:27:09 -08:00
PatR
ffac5f1a65 life-saving vs sickness
Replace an old instance of direct manipulation of an intrinsic.
If life-saving occurs 1 turn before sickness will kill the hero,
the sickness if cured.  But it was leaving delated_killer for SICK
allocated.  Harmless but a bug none the less.
2018-11-19 16:24:10 -08:00
PatR
46184c06af \#stats - delayed_killer
Include memory allocated to delayed killer(s) in #stats feedback.
2018-11-19 16:22:10 -08:00
Pasi Kallinen
b54dda5624 More monster location sanity checks
Placing a monster over already existing one will now complain.
Define EXTRA_SANITY_CHECKS to check monster removal too.
2018-11-19 22:38:16 +02:00
Pasi Kallinen
5acddebb3c Init long worm even if it does not have a tail
Long worms with no tail parts still apparently need to have
the zero-length tail placed.
2018-11-19 22:09:18 +02:00
Pasi Kallinen
20b47b5bbd Replace long worm on map after removing tail with wormgone
Calling wormgone will also remove the long worm monster from
the map, not just the worm tail. Put the monster back on map
so relmon can actually remove it properly.
2018-11-19 22:04:36 +02:00
Pasi Kallinen
b0428321b8 Explicitly remove long worm segments from the map
When a long worm was removed from the map, the segments for that worm
retained their map location info. This caused problems later on if
wormgone (or toss_wsegs) was called, because it would try to remove the
segments of that worm from the map.
2018-11-19 21:54:35 +02:00
Pasi Kallinen
2a439af336 More long worm checks when splitting
When a long worm is split into two, perform more checks placing
the segments on the map.
2018-11-19 21:49:52 +02:00
Pasi Kallinen
7119baafb8 Long worm may get killed in middle of action
If long worm attacks you, and you have a passive response that may
kill the worm (eg. blue jelly), the worm may die in the middle of
a loop checking for a worm segment that can attack. This'll cause
a segfault because the worm segments will get freed.

If the worm dies, just exit the loop.
2018-11-19 21:27:26 +02:00
Pasi Kallinen
9ad7268c0a Moving long worms may still put tail in old location
When using rloc and friends to move monsters, and the monster
happens to be a long worm, the tail may get randomly placed
in the same place where the long worm was removed from.

In the cases where we expect the location to really be free,
explicitly recheck the location for a monster after rloc.
2018-11-19 21:24:11 +02:00
Pasi Kallinen
657f557821 Fix vault guard not considering monsters in walls
Two different cases here: a) Vault guard did not move away monsters
except if they were standing on gold, and b) moving away monsters
on a completely filled level did not work
2018-11-19 21:20:43 +02:00
Pasi Kallinen
ebef31ffa5 Check monster relocation degenerate cases more strictly
Just in case we're trying to put the monster on the same location
where it already thinks it is... but actually isn't.
2018-11-19 21:16:50 +02:00
Pasi Kallinen
878ac24037 Fix freeing monsters not on map
Sometimes we free the monster data, but the monster is not on the
map - usually this happens if the map is full of monsters and a new one
is migrated on the level.

Make m_detach check the monster x coordinate, so it knows not to touch the map
if the monster isn't on it.
2018-11-19 21:16:46 +02:00
nhmall
a4eb3df5f0 Merge branch 'NetHack-3.6.2-beta01' into macosx-curses-fall2018 2018-11-19 09:58:40 -05:00
PatR
40ce977522 fix #H7573 - impossible zero payment in money2mon
When paying for shop door or wall damage, if the entire amount was
covered by shop credit then impossible "zero payment in money2mon"
would occur as the shop code tried to transfer 0 zorkmids from hero
to shopkeeper after using credit to pay.
2018-11-18 18:48:59 -08:00
nhmall
15da3e4d53 Merge branch 'win-curses' into macosx-curses-fall2018 2018-11-18 09:10:26 -05:00
nhmall
bc8be48a92 quiet some mismatched prototype warnings with visual studio compiler
pager.c
.\pager.c(1886): warning C4113: 'void (__cdecl *)()' differs in parameter lists from 'void (__cdecl *)(void)'
.\pager.c(1887): warning C4113: 'void (__cdecl *)()' differs in parameter lists from 'void (__cdecl *)(void)'
.\pager.c(1888): warning C4113: 'void (__cdecl *)()' differs in parameter lists from 'void (__cdecl *)(void)'
.\pager.c(1889): warning C4113: 'void (__cdecl *)()' differs in parameter lists from 'void (__cdecl *)(void)'
.\pager.c(1890): warning C4113: 'void (__cdecl *)()' differs in parameter lists from 'void (__cdecl *)(void)'
.\pager.c(1891): warning C4113: 'void (__cdecl *)()' differs in parameter lists from 'void (__cdecl *)(void)'
.\pager.c(1893): warning C4113: 'void (__cdecl *)()' differs in parameter lists from 'void (__cdecl *)(void)'
.\pager.c(1895): warning C4113: 'void (__cdecl *)()' differs in parameter lists from 'void (__cdecl *)(void)'
.\pager.c(1896): warning C4113: 'void (__cdecl *)()' differs in parameter lists from 'void (__cdecl *)(void)'
.\pager.c(1897): warning C4113: 'void (__cdecl *)()' differs in parameter lists from 'void (__cdecl *)(void)'
.\pager.c(1898): warning C4113: 'void (__cdecl *)()' differs in parameter lists from 'void (__cdecl *)(void)'
.\pager.c(1902): warning C4113: 'void (__cdecl *)()' differs in parameter lists from 'void (__cdecl *)(void)'
.\pager.c(1921): warning C4113: 'void (__cdecl *)()' differs in parameter lists from 'void (__cdecl *)(void)'
2018-11-18 08:45:32 -05:00
nhmall
312f492149 Merge branch 'win-minor' into win-curses 2018-11-18 04:32:28 -05:00
PatR
27fe555bc1 src/ formatting
Clean up quite a bit of minor things found with simple grep patterns:
operator at end of continued line instead of beginning of continuation
(and a few comments which produced false matches, so that they won't
do so next time), trailing spaces (only one or two of those), tabs (a
dozen or so of those), several casts which didn't have a space between
the type and the expression (I wasn't systematic about finding these).

I think the only code change was in the function for the help command.
2018-11-17 16:40:53 -08:00
nhmall
39c8f4347a Merge branch 'win-minor' into NetHack-3.6.2-beta01 2018-11-16 23:55:02 -05:00
PatR
141dec6d2e feedback for missing readonly data files
If bogusmon, engrave, epitaph, oralces, or rumors won't open, assume
it's because the file is missing so don't have impossible() tack on
"saving and restoring might fix this" when telling the player.
(Missing rumors or oracles previously only used pline() rather than
impossible() so this hadn't been an issue for them.  Now it would be.)
2018-11-16 18:49:12 -08:00
nhmall
cb43061076 curses changes to existing files 2018-11-16 20:51:22 -05:00
nhmall
96ec49213f Add some windows command line option hooks 2018-11-16 19:32:00 -05:00
nhmall
731e10f058 follow-up bit for stale gold sym 2018-11-15 02:51:27 -05:00
nhmall
acdc62a861 stale gold symbol displayed after symset change
a stale gold symbol could be displayed on the status line following a switch
to a new symset, as observed and reported for Windows RogueEpyx symset.

An update is required for gold in the status line for a change to
any of the following:
    context.rndencode value
    the encoded glyph value for COIN_CLASS
    the gold amount
2018-11-15 02:34:45 -05:00
PatR
bd4cacbc52 fix #H7536 - pet vampire behavior
Vampires tend to take vampire bat form and stay that way, unless/until
there's a closed door they want to pass in which case they change to
fog cloud form.  Those shifted forms are weak, so pet vampires tend
not to attack other monsters, and if they don't take damage, they
won't change to vampire form.  So, when comparing relative strength of
self and foe while deciding whether to attack another monster, treat
their own strength in weak form as if in vampire form, making them be
more aggressive.

Hostile vampires shouldn't need any comparable change.  They don't use
relative strengths when deciding whether to attack something.
2018-11-13 16:29:48 -08:00
PatR
a97d0b7270 fix github issue #159 - eating nurse corpses
Fixes #159

The nurse monster definition is flagged to be able to convery poison
resistance when a corpse or tin is eaten, but the post-corpse code
for nurse healed HP and cured blindness then skipped the intrinsic
handling.
2018-11-13 15:05:54 -08:00
PatR
5c2ff62089 comment tidbit 2018-11-12 11:08:59 -08:00
PatR
1295e7ee28 conflicting countdowns again
Use the make_foo() intrinsic set/reset routines instead of trying
to manipulate the intrinsics directly.  Previous patch left Dex
down by 1 if stoning caused wounded legs to be fixed, and left
delayed killer allocated if stoning cured sliming or vice versa.
2018-11-12 11:02:40 -08:00
PatR
53a6ce2c2a conflicting countdowns
I tried 'pick all' in the #wizintrinsics' menu and after 30 turns,
died with "poisoned by a poisoned, while vomiting".  Food poisioning
and/or terminal illness beat the other fatal conditions to the coup
de gras.  However, the final stage of vomiting sets Sick to 0 cure
food poisoning and ends up clobbering the killer reason if Sick is
due to terminal illness.  It's feasible for that to happen without
using #wizintrinsic, so this fixes that, and also a few other
combinations that seemed contradictory:
1) limbs turn to stone during Stoned countdown now cures wounded legs;
2) turn to stone (a couple of turns later) cures vomiting and sliming;
3) turning to slime during Slimed countdown cures stoning.
2018-11-12 02:13:32 -08:00
PatR
a22175cd99 prayer vs blocked by boulder
Salvaged from an old, unfinished patch.  When checking whether the
hero is trapped by walls and solid rock, adjacent boulders are
evaluated on whether they can be pushed out of the way.  Extend that
evaluation:  (1) two boulders on a spot are pushable if there is a
pool beyond that spot, and (2) boulders can't be pushed diagonally
in Sokoban.
2018-11-11 16:04:45 -08:00
PatR
ab7fb9360e fix #H7065 - clairvoyance shows trap over monsters
and over the hero.  3.6.0's clairvoyance tried to show things in
a non-standard sequence, which was intentional but had unintended
side-effects like the disappearing monsters complained about in the
report.  To make it work as intended would have required --More--
whenever it kicked in, which is much too intrusive when it happens
every N turns rather than when explicitly casting the spell.

Redo it substantially, and give preference to monsters over objects,
objects over traps, and traps over underlying terrain like normal
vision-based display does.  It now detects all monsters within its
bounding box but shows ones which aren't directly in view as
"unseen monster" unless via spell cast at skilled or expert, or at
basic when also having intrinsic clairvoyance.
2018-11-11 14:28:54 -08:00
nhmall
a0b53ee391 merge 2018-11-11 10:29:52 -05:00
PatR
e486d941ed couple of #wizintrinsic fixes
When #wizinstrinsic was expanded to be able to set any timed attribute,
some that need more than just a timeout counter were left inconsistent.
1) Timed Flying wasn't blocked by levitation, and existing flight
   wasn't becoming blocked by timed levitation.  Also, eventual flight
   timeout wasn't updating the status line, so false 'Fly' condition
   remained shown until a status update happened for some other reason.
2) Setting timer for Warn_of_mon didn't set up any type of monster to
   warn about so wouldn't do anything.  This sets that to grid bug
   unless already set due to polymorph form or artifact that warns.

The end.c portion is just a bit of formatting.
2018-11-10 18:22:38 -08:00
PatR
e8a8f142ae otransit_msg() fixes
Fixes #156

githib issue #156 complains that "The Excalibur falls down the stairs,"
is using poor grammar despite the fact that the usual drop message is
"You drop the +0 Excalibur."  I agree.  Change it to be "Excalibur
falls down the stairs."  (Drop message remains unchanged.)

While looking at that, I noticed that when knocking other items down
stairs, text was being appended to the formatted object name.  It was
probably safe due to the space reserved for inserting a prefix while
formatting an object's name, which becomes available for a suffix
after that name has been copied into otransit_msg()'s local buffer,
but using a separate buffer is safer.
2018-11-10 01:37:23 -08:00
PatR
8551df2a7a impossible worm_cross non-adjacent location
Attempting to mount a long worm tail could yield
\#ride -> mount_steed() -> test_move() -> worm_cross() ->
impossible("worm_cross checking for non-adjacent location").
2018-11-09 15:43:50 -08:00
PatR
91f973306b build and bug fixes for USE_OLDARGS
New:  call to panic() in impossible() used arbitrary string as a
format so was vulnerable to percent signs in that string.  (This
potentially serious problem is not limited to USE_OLDARGS.)

Old:  revised message string for impossible ("save/restore might fix
this" instead of "perhaps you'd better quit") passed wrong number of
arguments to pline() when using the clumsy VA_PASSx() mechanism (was
missing arg 0 for the fixed-arg format argument).

Old:  varargs config_error_add() in files.c wouldn't compile for
USE_OLDARGS.  Evidently no one has been impacted by that but this
fixes it anyway.  (Two problems:  prototype used FDECL() when it
should have been using VDECL(), and calls to config_error_add() in
the same file would need the VA_PASSx() stuff to force presence of
all optional args.  I moved it instead of adding the latter.)
2018-11-08 15:33:03 -08:00
Pasi Kallinen
f9f1236f26 Fix some buffer underflows 2018-11-08 21:02:24 +02:00
Pasi Kallinen
0bb6754998 Fuzz testing debug tool
Add code to run a fuzz tester, simulating (more-or-less) random
keyboard mashing. There's no option to turn it on, you need to
set iflags.debug_fuzzer on via a debugger or something along
those lines.
2018-11-08 15:55:49 +02:00
PatR
4f541fe216 ^X about armor
Enlightenment feedback for "nudist" was added 3.5 years ago.  Ever
since, ^X has been reporting "you are not wearing any armor" when
wearing a shield without any other armor.

Since Valkyrie starts in that situation, it's very surprising that no
one ever noticed 'til now (or did notice and didn't bother to report).
2018-11-07 14:50:44 -08:00