Commit Graph

113 Commits

Author SHA1 Message Date
PatR
f81818e85d fix #H7226 - vault guard should have whistle
Implement the suggestion that since teleporting away from the vault
while being confronted by the guard results in a shrill whistling
sound, the vault guard ought to have a tin whistle in his inventory.

I also added a check that he does have the whistle and to give an
alternate message if not, but after half a dozen tries to have a
squad of beefed up monkeys steal the whistle, they never accomplished
that.  At least three times they took everything except the whistle
but I never succeeded in verifying the alternate message.
2018-06-15 16:24:02 -07:00
keni
d8c49ec9d1 Add updated copyright lines, part 1. 2018-04-25 15:00:13 -04:00
Pasi Kallinen
2548d68dd3 Fix some warnings
Remove an unused variable, add missing FALLTHRUs, and use the same
FALLTHRU wording where it wasn't recognized by gcc
2018-03-30 19:42:50 +03:00
PatR
ed572e5e84 high priest extinction
This issue has been around for a while but wasn't noticable to players
until some post-3.6.0 tweaking of end of game disclosure.  When testing
the DUMPLOG artifact_score fix, I level teleported to the Astral Plane
and performed a cheat ascension.  Final disclosure listed high priests
as extinct.  Same thing would happen after visiting Moloch's Sanctum
instead.  (The latter didn't interfere with creating the Astral high
priests if you got that far, just as creation of the first one there
didn't prevent the other two.)

I forget why high priests are flagged as unique (something I think
I'm responisble for...), but they shouldn't share unique's setting of
extinct during monster creation.  (They could be set that way after 4
are created, but this fix doesn't do that.  It just treats them like
ordinary monsters so you'd need 127 or 255 or some such to make them
become extinct.  Unlike other creatures with a special creation limit,
high priests can be produced when aligned priests gain experience--an
event that I don't recall ever noticing happen.)
2017-05-19 16:51:05 -07:00
PatR
8c92d2921f fix #H5082 - growing into opposite sex monster
When a female dwarf grows (via level gain) into a dwarf lord, it
changes sex as well as base monster form because all dwarf lords
are male.  The earlier fix for #H4276 (16-Mar-2016, to give an
alternate grow-up message acknowledging the change) used the wrong
monster form (monst's old one instead of new one).
2017-02-17 12:24:24 -08:00
Pasi Kallinen
710f5ed235 Give quest guardians some equipment 2016-10-08 21:17:58 +03:00
Pasi Kallinen
996dd7192d Horses have a tiny chance of being generated with a saddle
Saddles are rare. Make them less so by giving domestic saddleable
creatures 1% chance of being generated with a saddle.
2016-09-19 15:44:07 +03:00
PatR
bc91a01fdd potential ctype.h issues
A few things which might conceivably pass negative values to ctype
routines.  Some are post-3.6.0.  None of them explain the sporadic
Windows assertion failure.

Using tolower() without verifying the argument isupper() should be
completely safe when tolower() is a function but might not be when
it's a macro.  (Likewise for toupper() without islower().)  NetHack's
lowc() function is always safe, at least for ASCII.
2016-05-22 17:29:59 -07:00
PatR
c1bfa1360f mon->mhp manipulation
I've hunted for other instances where monster hit points were set
to zero or less without calling the routine that kills off the
monster (see recent mon_unslime() vs zhitm()) and didn't find any
for mhp subtraction.  I haven't checked for direct assignment yet.

For a while I thought I'd found several cases where a monster was
intended to be killed but got left with positive hit points, but
it turned out that lifesaved_monster(), of all places, was setting
them to zero.  I've moved that to its callers so that it isn't so
well hidden.  And changed several ''if ((mon->mhp -= dmg) <= 0)''
into separate subtraction and 'if' just so the mhp manipulation is
a bit more visible.

I think the only actual change here is the message for monster
being killed by lava, where glass golems now melt instead of burn.
2016-05-21 18:25:16 -07:00
PatR
e0537a76d4 disclosing genocided/extinct monsters
Make the handling of unique monsters consistent between vanquished
monsters and genocided/extinct monsters.  No visible difference to
players.

This also prevents Nazgul and erinys from being polymorphed into
some other form to reduce the chance that their kill count fails
to match the expected number when they're reported to be extinct.
[My long test game (with 3451 total dead critters as of the last
save file) used for exercising the sorting of vanquished monsters
included
 120 soldiers
 111 wolves
   9 Nazgul
   2 erinyes
and the genocided/extinct list had none genocided, those four
extinct.  No doubt the missing third erinys was alive somewhere
rather than counted as something else after getting polymorphed,
so this band-aid wouldn't have helped this particular game.]
2016-05-04 17:42:58 -07:00
PatR
d6fa06f8e8 zeromonst
Make 'zeromonst' global instead of local to makemon.c.  Its address
isn't used as a special value like &zeroobj, but it is useful to
have available for initializing various pseudo-monsters.

modified:
  include/decl.h
  src/decl.c, makemon.c, mkobj.c, mplayer.c, teleport.c
2016-03-26 16:42:24 -07:00
PatR
606a738c4b fix #H4274 - monster growing up changes gender
Most of the humanoid species have Lords and several have Kings,
but none of them have Ladies or Queens.  When a female grows up
to reach that level of monster, she changes into male.  This fix
gives an alternate message acknowledging that change rather than
prevent taking on the stronger form.  A better fix would be to
add ogre ladies and dwarf queens as separate monsters, but doing
so will break 3.6.0 save file compatibility.

(I started out with an alternate fix, adding mons[].fname for the
dozen or so creatures which warrant an alternate name for females.
But that requires statues, figurines, corpses, tins, and maybe
even eggs to track gender [some statues already do, and corpses
and statues with attached mtraits also implicitly do] and to not
stack with equivalent ones of the opposite gender.  Plus glyphs
to track them, and new tiles.  It was becoming too complicated
for such a relatively unimportant feature.  Separate monsters is
the way to go, deferred until save file format changes again.)
2016-03-16 15:03:37 -07:00
Pasi Kallinen
e55dd6919a Fix prot from shape changers at level generation
Mimics and other shape changers created at level generation
did not obey protection from shape changers.
2015-12-26 21:40:22 +02:00
PatR
c097814f3c warning bit
Suppress a couple of 'dead increment' diagnostics from the clang static
analyzer.  The assignments are dead, but keeping the variable up to date
is more valuable (in case someone someday changes the code to use the
affected variable somewhere farther along in that function) than changing
the code to avoid the assignments in order to prevent the diagnostic.

This will only work to suppress the analyzer's diagnostic messages if
either FORCE_ARG_USAGE or GCC_WARN is defined when compiling makemon.c.
2015-12-18 07:18:58 -08:00
PatR
171fb90746 !DEBUG warnings
With DEBUG suppressed, I started getting
16      warning: empty body in an if-statement
and 2   warning: empty body in an else-statement
from gcc.

Using braces for an empty block instead of just ';' avoids the warning:
    if (foo)
        debugpline("foo");
is bad,
    if (bar) {
        debugpline("bar");
    }
is good.  ;-)

The changes to lint.h are just precautionary.

modified:
    include/lint.h
    src/attrib.c, bones.c, dbridge.c, dig.c, eat.c,
        makemon.c, mkmaze.c, mon.c, sp_lev.c
2015-12-04 14:58:49 -08:00
PatR
e78e393a81 lint cleanup
A couple of things 'gcc -g' didn't care about 'gcc -O2' mistakenly
thinks 'may be used uninitialized'.
2015-12-02 02:36:29 -08:00
Pasi Kallinen
e1090de7b3 Declare missing function proto 2015-11-21 20:47:31 +02:00
Pasi Kallinen
acc883f122 Comment typofix 2015-11-16 11:46:45 +02:00
PatR
c09fe294dd formatting: more casts 2015-11-07 20:02:04 -08:00
PatR
915dd89270 more src reformatting
Fixing up mis-indented block comments, but hit some files that hadn't
had the earlier mixture of tab replacement, etc, so it's bigger than I
expected.  If I get to it, they'll be another round of this tomorrow.
2015-11-06 03:14:50 -08:00
PatR
ea8a1beb0a formatting: src/m*.c - p*.c continuation lines
Somewhere along the line I started removing redundant parentheses from
return statements, but only in files that needed continuation fixups
so it's not comprehensive.
2015-10-22 16:35:01 -07:00
Pasi Kallinen
f8b48490aa Comment typofixes 2015-10-17 12:28:52 +03:00
Pasi Kallinen
2f54ed8eae Fix the makemon random coord picking again
This time try random locations up to 50 times, then start going
through the map in order to find a good position. First round
tries to pick a location not in sight, if that fails, it might
try stair or ladder location. If that fails, then it will pick
any good position, whether in sight or not.

Outside field of vision restriction and trying stair or ladder
locations does not happen when the monster is placed from special
level code.
2015-10-12 12:00:51 +03:00
Pasi Kallinen
185515e1c7 Fix infinite loop in makemon if no goodpos available
If the level was full of monsters, goodpos never returns TRUE,
and tryct would not get incremented.
2015-10-11 16:18:13 +03:00
Pasi Kallinen
fe073055b6 Comment typofix 2015-06-25 08:08:39 +03:00
Pasi Kallinen
e0cf17e660 Fix the shapechanger fix again 2015-06-14 11:48:10 +03:00
Pasi Kallinen
0c3ee5025e Shapechangers got a completely random form
mtmp->cham was NON_PM, which select_newcham_form interpreted as a completely
random form.  This also resulted Vlad getting a random shape, and not getting
the Candelabrum, making the game unwinnable.
2015-06-14 10:40:25 +03:00
PatR
def2549592 shapeshifting on rogue level
Limit vampire shapeshifting on rogue level to vampire bats (only
choice represented by uppercase letter) and have other shapeshifting
try for uppercase.  The latter isn't rigorous because shapeshifters
(chameleon=':', doppelganger='@', sandestin='&') aren't uppercase
themselves, so won't be created there under ordinary circumstances.
It applies to the "summon nasties" monster spell and post-invocation/
post-Wizard's-death harassment effect too.
2015-06-04 15:31:25 -07:00
Pasi Kallinen
8d1e49f094 Dwarves may be generated with dwarvish spears 2015-06-04 21:01:45 +03:00
Pasi Kallinen
13ef4962fd Reduce the number of gnomes with candles
Gnomes in mines during level generation have 1/20 chance of getting a candle
(should give approximately 4 candles in all of the mines total), and every
randomly generated gnome has 1/60 chance.
2015-06-01 15:59:43 +03:00
PatR
5f02b15a75 mimics mimicking strange objects
The code that intended to have mimics occasionally take on the form
of "strange object" always produced downstairs instead because
S_MIMIC_DEF is greater than MAXOCLASSES.

This problem was present in 3.4.3.  I didn't try to go back to see
how long it's been there, but strange objects used to occur once
upon a time.  Either nobody noticed that they'd gone away or there's
an alternate way to produce them.
2015-05-26 17:16:30 -07:00
Sean Hunt
1c081b1647 Remove stale version control lines. 2015-05-25 09:21:31 +09:00
Sean Hunt
97d6fade74 Reformat all C files.
I'll push a formatting guide at some point. There may still be
outstanding changes, but please feel free to resolve those as you arrive
a them.

To the best of my knowledge, there is no changes to the actual code
content, but the formatter does have the occasional bug. If you run into
an issue, please fix it!
2015-05-09 13:43:16 -04:00
karnov
2a907f894e Version number increment 2015-05-06 22:04:27 -04:00
Pasi Kallinen
ea6157c475 Give gnomes occasionally a candle
...and if in unlit area, light the candle.
2015-04-23 21:19:25 +03:00
Pasi Kallinen
fdc7e980ea Prevent segfaults, makemon can return null 2015-04-03 14:46:28 +03:00
PatR
ed85d3f158 objnam formatting for bag of tricks
Bag of tricks that had been used at least once was being described
as "empty" regardless of charge count, because it always fails the
Has_contents() test.  After half this patch fixed that, it started
being flagged as "empty" as soon as the last charge was used rather
than after attempting to use it again after that, since 'cknown' was
being set whenever it was used.  Only set that flag when applying
the bag has been observed to fail.
2015-03-27 00:21:40 -07:00
PatR
14525ed0c6 DEBUG/debugpline() fixup
* Replace variadic debugpline() with fixed argument debugpline0(str),
   debugpline1(fmt,arg), and so on so that C99 support isn't required;
 * showdebug() becomes a function rather than a macro and handles a
   bit more;
 * two debugpline() calls in light.c have been changed to impossible();
 * DEBUGFILES macro (in sys.c) can substitute for SYSCF's DEBUGFILES
   setting in !SYSCF configuration (I hope that's temporary).
2015-03-15 18:02:26 -07:00
Pasi Kallinen
612852f7de Apply paxed's DEBUG patch to remove DEBUG/D_DEBUG.
Move debugging output into couple preprocessor defines, which
    are no-op without DEBUG.  To show debugging output from a
    certain source files, use sysconf:

    DEBUGFILES=dungeon.c questpgr.c

    Also fix couple debug lines which did not compile.

This also includes fixes due to Derek Ray to depugpline to work better
on other platforms.
2015-02-27 19:33:45 -05:00
Sean Hunt
ac108cd365 Make GOLDOBJ unconditional. 2015-02-27 19:33:40 -05:00
Sean Hunt
4f59f5c6fd Make WIZARD unconditional. 2015-02-27 19:33:22 -05:00
Sean Hunt
1edadd1d48 Make REINCARNATION unconditional.
There is a lot of code affected by this, and Pat Rankin correctly
observes that it would be better to store roguelike as a level flag
rather than just using Is_rogue_level. A note for the future.
2015-02-27 19:33:16 -05:00
Sean Hunt
b066b7c170 Make KOPS unconditional. 2015-02-27 19:33:04 -05:00
keni
03140969ee Bulk recovery of file CVS headers and addition of NHDT- headers. 2015-02-26 09:19:03 -05:00
nethack.rankin
c76362833a bit logic fix (trunk only)
Fix some expressions that were supposed to use bitwise '&' but were
accidentally using logical '&&', pointed out by Keni's lint tool.  All 3
instances are in post-3.4.3 code, so don't affect the branch and don't
need a fixes entry.
2012-01-29 00:34:33 +00:00
keni
6520bbdca9 first try tonight: lock.c makemon.c 2011-12-30 23:10:37 +00:00
nethack.rankin
95f5e029d8 avoid mkclass() infinite loop (trunk only)
Back on Feb 28, I committed a patch to prevent the special level
loader from generating mail daemons for levels which specified random
demons.  It had a pair of copy+paste mistakes that could result in
mkclass() looping forever.  It was looking at the same monster every
time and if that monster was one which mustn't be generated, it would
just keep repeating.
2011-04-21 00:29:26 +00:00
nethack.rankin
9e7df53b84 spurious mail daemons (trunk only)
From the newsgroup:  when the special level loader is creating
random '&' class monsters, it can produce mail daemons.  The thread
reports seeing some on the levels holding the Wizard of Yendor's Tower
and they vanish as soon as it's their turn to move.  I didn't reproduce
it, but create_monster() is overriding the NOGEN flag when it calls
mkclass() so getting mail daemons is feasible.  This fixes that by
treating them similar to the human/elf/orc/giant placeholder monsters
that are excluded from random generation.  More or less.
2011-02-28 03:36:08 +00:00
keni
4eabcee787 Add RCS version lines 2009-05-06 10:50:32 +00:00
nethack.rankin
e205569714 extended quest text formatting (trunk only)
Add questpgr formatting codes to support pronouns for leader,
nemesis, deity, and artifact.
  %lh -> "he" or "she" for leader; %nh for nemesis; %dh for hero's god;
  %li -> "him" or "her"; likewise %ni, %di;
  %lj -> "his" or "her"; and %nj, %dj;
H, I, and J modifiers yield capitalized form of same.
  %oh -> "it" or "they" for artifact (Eyes of the Overworld is plural);
  %oi -> "it" or "them";
  %oj -> "its" or "their"; plus capitalization with uppercase modifiers.
Also, %O yields shortened artifact name ("the Foo" in place of "the Foo
of Bar").  These provide support for terser summary lines, but can also
be used in the regular quest text passages.

     A couple of nemeses don't specify gender.  The random choices need
to be made early so that the leaders' messages can get them right.  This
chooses during role initialization and then uses that result once the
corresponding monster is eventually created.  It does the same for leader
even though no current leader needs it, and for deity too.
2009-04-07 02:19:54 +00:00