Commit Graph

6134 Commits

Author SHA1 Message Date
PatR
bde2aa5ea2 lev_comp shifts of negative values
Apparently the compiler for OSX 10.11 + Xcode 7.3.1 is defaulting
to C99 (or C11?) because it is enabling a gcc warning that is
included by -Wextra (newer name for obscure -W) for C99 or later.

lev_comp.y:2276:20: warning: shifting a negative signed value is undefined
 [-Wshift-negative-value]
       (yyval.i) = SP_OBJ_PACK(-1, (yyvsp[(1) - (1)].i));
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../include/sp_lev.h:248:33: note: expanded from macro 'SP_OBJ_PACK'
\#define SP_OBJ_PACK(o, c) (((o) << 8) + ((char) (c)))
\                            ~~~ ^

SP_MONST_PACK() and SP_OBJ_PACK() are both called with -1, and
SP_MAPCHAR_PACK() is called with either -1 or -2.  The revised
macros add 10 when encoding and subtract it when decoding so that
they can handle -1 through -10 without shifting negative values.

There were also several bitwise ANDs that the bulk reformatting
misclassified as casts of hardcoded addresses.
2016-08-03 01:17:43 -07:00
PatR
2160dee4ca lint suppression
botl.c   - unused argument in #if STATUS_HILITES code.

mkmaze.c - "clang version 7.3.0 (clang-703.0.31)", or whatever version
  of gcc it's based on, warns that ''#define register /*empty*/''
  hides a keyword.  '-Wkeyword-macro' isn't mentioned in the recent gcc
  manual I checked, but it is being enabled by specifying '-pedantic'
  (rather than -Wall or -W) to the preprocessor.  It could be turned
  off via '-Wno-keyword-macro' but this removes all mkmaze.c's register
  references instead.  (Sean wanted that, and this might be why....)
2016-07-30 19:08:25 -07:00
PatR
e5263b5ff0 fix #H4460 - tribute typos in /Thud!/
Passage 2: DELIBERATEDLY -> DELIBERATELY
Passage 6: vengence -> vengeance
2016-07-30 14:53:00 -07:00
PatR
5e0cf04b04 update sys/unix/hints/macosx10.10
On OSX, one of the XQuartz header files triggers a compiler warning
about using a gcc extension, resulting in a diagnostic for each of
the files compiled with the WANT_WIN_X11 set of CFLAGS.  Use the
same fix as hints/macosx10.8 already does.
2016-07-30 01:59:27 -07:00
PatR
6632c380f3 fix #H4457 - grammar nitpick
"Your pair of speed boots glow silver for a moment." should be
"Your pair of speed boots glows silver for a moment.".  The fix
reverses a post-3.6.0 change to is_plural().  Also, add new
pair_of() to test for object formatted as "pair of Bars".  For verb
usage, that's definitely singular, but for pronoun usage, sometimes
plural seems better (although it might actually be incorrect).

I fixed up the formatting of a block comment in obj.h, but it is
still a candidate for tab cleanup.
2016-07-30 01:19:44 -07:00
PatR
d466dc3742 lint cleanup: '!mptr->mmove == 0'
The compiler whined about that, and rightly so.  It happens to yield
the right value by accident, so there should be no change in behavior.
2016-07-29 18:09:01 -07:00
PatR
d69f0787be add '(uchar)' casts to ctype calls
This is from the pull request for the assertion failure fix.  It
did not mention how to reproduce the assertion failure, just added
casts to a bunch of isspace/isprint/tolower calls that didn't already
have such.

I removed an obsolete change for win/tty/topl.c and changed the
win/win32/mswproc.c code to avoid using an expression with side-effects
(*colorstring++) in calls to tolower() in case someone overrides that
with a macro which evaluates its argument more than once as some pre-
ANSI ones used to do.  Not tested, might have typos....

sys/wince/*.c still needs similar casts.
2016-07-19 05:40:09 -07:00
PatR
5713f92df1 fix #H4436 - polyself message sequencing bug
for digesting a swallowed critter.  The "you kill <critter>" message
was left implicit, but if hero gained a level, that made "welcome
to level N+1" look like it was issued out of sequence because it's
immediate and the "you totally digest <critter>" is delayed.  Giving
the you-kill-it message explicitly makes things be more verbose but
avoids having the new-level message seem out of order.
2016-07-13 16:16:55 -07:00
PatR
ff29971453 fix #H4426 - shapeshifted vampires vs stoning
and vs digestion.  minstapetrify() was previously changed to
explicitly revert a shape-shifted vampire back to vampire form
when it was turned to stone.  This does the same for monstone().
It also causes shape-shifted vampires to revert to vampire form
immediately when swallowed, so subsequent death via digestion or
engulfing damage doesn't have to deal with reverting changed shape.

I'm not convinced this is the right fix for either stoning or
being digested.  Unlike with ordinary damage, where multiple hits
are usually needed to kill a vampire after it reverts to 'V' form,
here the vampire will be killed by the next successful stoning or
digestion attack in one hit.  It ought to least try to flee.
2016-07-11 17:38:02 -07:00
PatR
47572a7946 fix #H4428 - mon vs mon thrown cockatrice egg
There was no code in ohitmon() (for object thrown or launched at a
monster by someone or something other than the hero) to handle an egg
hitting a monster.  Cockatrice egg is monsters' preferred missile,
but if one hit a monster instead of hero it just did minimal damage
without any chance of the side-effect that makes it be preferred.
2016-07-09 16:15:37 -07:00
PatR
617ab5968f observing monster become invisible
Requested by one of the beta testers 13 months ago... when a visible
monster becomes invisible and vanishes, mark its map location with
the remembered, unseen monster glyph.  (When the player zaps a
monster with a wand of make invisible, that only happens if the wand
type is known.  I'm not sure that's right but didn't alter it....)

The request suggested also doing it for a monster who disappears by
teleporting away, but I haven't attempted to implement that.
2016-07-09 15:03:03 -07:00
PatR
eb22f7f583 fix #H4427 - confused scroll of light
When scroll of light is read while confused and summons a yellow or
black light, if it didn't have a user-supplied type name then user
would be asked to supply one even if scroll of light was identified.
Let effect()'s caller handle docall().
2016-07-05 04:31:51 -07:00
PatR
9f89c0792c fix #H3907 - wrinkled spellbook tile
Reported 11 months ago for 3.4.3, the tile for wrinkled spellbook
has a spurious brown spot on the far right.  Several other books
have spots drawn outside the book proper for tile decoration, but
that doesn't seem to apply here.  The report suggested changing
'K' to 'M', but that just changes it into a spurious white spot.
Change the stray 'K' to '.' to make the odd spot go away.
2016-06-30 06:03:51 -07:00
PatR
cb0f508f1c tty message history line-wrapping fix
Reported directly to devteam last October, for 3.4.3 on NAO,
subject "UI flaw in message history":

"Applying the stethoscope at self informs:
"Status of Xxxxxxxx (piously neutral):  Level 14  HP 138(138)  AC -15, very
"fast, invisible.--More--

This is reproducible with shorter character name "wizard" by being
"nominally neutral" or "nominally chaotic".  I had a 2 digit level
but didn't notice that my AC took up only 1 digit and ended up
using 125ish blessed potions of full healing to get 4 digits of hit
points in order to get the line to wrap between "very" and "fast".

"But the message history with Ctrl-P shows:
"Message History
"
"Status of Xxxxxxxx (piously neutral): Level 14 HP 138(138) AC -15, very
"invisible.

The key was "Message History", indicating msg_window:full or other
setting which causes ^P to bypass the top line message window and
use a general text window to deliver all history lines at once.

The original feedback splits the line by replacing the space
between "very" and "fast" with a newline, which topline handling
notices and processes as special, but then leaves in place.
msg_window:full results in tty_putstr() case NHW_TEXT, which treats
newline as an ordinary character since it doesn't expect to see
that in text.  Squeezing out three doubled spaces made room for
"very\nfast," on the top line.  process_text_window() attempted to
write it there, but putchar() wrote up through "very," on one line,
then output the newline which resulted in "fast," on the next line.
Then explicit cursor positioning set things up to put "invisible"
at the start of that line, overwriting "fast," so making it appear
to be missing.
2016-06-29 18:55:02 -07:00
PatR
805f7c5644 fix #H4418/#H4419 - #tip of gold inside shops
The #tip command tries to reduce verbosity by formatting drop messages
with just the object name instead of with full sentences, yielding
  Objects spill out: obj1, obj2, obj3, ..., objN.
where the trailing comma or period is included with each successive
object.  If an intervening message occurs, such "25 zorkmids are
added to your credit", the rest of the objects will no longer be
extending the original sentence and end up looking silly.
  Objects spill out: obj1, obj2,--More--
  25 zorkmids are added to your credit.  obj3, ..., objN.
This fix causes the post-interruption messages to revert to verbose
format.
  Objects spill out: obj1, obj2,--More--
  25 zorkmids are added to your credit.--More--
  obj3 drops to the floor.--More--
...
  objN drops to the floor.

The interrupting message still follows the comma of the partial
sentence, but I don't see any sane way to fix that other than to
abandon the terse format altogether, and doing that makes #tip way
too verbose when the container has a lot of items in it.  But #tip
inside shops now does that, since there will always be buy/not-
interested feedback interrupting the terse format in that situation.
For other situations, a full sentence message might end up following
a partial sentence list of dropped items.

There was a more significant bug.  Dropping a hero-owned container
with gold in it onto shop floor sold the gold to shk, giving hero
credit.  Subsequent #tip gave the hero credit for that same gold
when it spilled out.  addtobill(obj) relies on obj->ox,oy to
determine whether events are taking place in a shop, and #tip was
relying on placement onto floor to set those, too late for shop
billing.  The fix yields suboptimal results:  you're given credit
when you drop the container, then during #tip when you spill the
contents, credit for the gold is removed, then new credit for it
is given.  That's down to shop insanity, not tipping behavior.
2016-06-27 17:20:28 -07:00
PatR
6e56c796c9 fix #H4414 - orcs vs elven gear
I considered several potential interactions for orcs with elven
armor (and elves with orcish armor), such as longer wear/unwear
delay, reduced AC, or reduced magic cancellation/negation.  None
of them seemed worth doing.  In the end I just went with lembas
wafer tweaks:  new message when orc hero eats one, reduced nutrition
for that combination, different new message when elf hero eats one,
and increased nutrition for this combination.  Also, less increased
nutrition when a dwarf hero eats a cram ration.

I'm not particularly happy with either of the new messages, and
changing nutrition on the fly may lead to bugs.
2016-06-27 04:56:06 -07:00
Pasi Kallinen
2c32d69a23 Fixes entry 2016-06-27 12:03:34 +03:00
PatR
66e7b84077 flyers vs kelp
Flying monsters that want to pick up items tend to get stuck above
kelp fronds, particularly on the Medusa level.  They're allowed to
move to the water location, but can't reach an underwater item so
end up doing nothing.
2016-06-25 14:59:52 -07:00
PatR
98a90e353b more #H4407 - #loot vs cockatrice corpse
Previous fix was 'me' to eat from inventory without checking current
location for edible items.  The report describing the need for that
also mentioned that you could #loot while blind and without gloves
and not touch any objects except for the container you pick to loot.
This adds a corpse touch check, plus `m#loot' to skip floor containers
and go directly to using #loot for adjacent saddled creature.  That,
as well as the open command, will reveal adjacent container in some
circumstances but I'm going to pretend that that doesn't matter.

doloot() has turned into spaghetti.  We should probably add #unsaddle
or something of the sort and return #loot to container-access only.
2016-06-25 00:10:01 -07:00
PatR
eb1add8500 fix #H4407 - avoiding floor-food while blind
Accept the 'm' prefix for eat, offer, and apply.

Allows 'me' to eat from inventory without checking for floor food.
Primarily for use after blind character used 'm<dir>' to move
somewhere without touching a suspected cockatrice corpse there.

'm#offer' and 'ma<let>' accomplish similar floor-object-skipping
when offering a sacrifice or applying a tinning-kit.  (All three
commands share floorfood() to pick the item to use.)

Report suggested replacing pick-from-floor followed by pick-from-
invent with use of slash'em-style pick-from-invent with explicit
pick-from-floor choice in list of inventory letters "[abc or ,]"
(slash'em used period for 'here'; I've always liked comma better
since the action is to pick an item rather than a location).  I
implemented that for nethack a long time ago, but it was mixed in
with other stuff that wasn't ready for prime time and vanished
when I lost access to the VMS system I used to use).

Using 'm' prefix to skip part of a multi-part operation is a lot
simpler to implement but doesn't include an in-game reminder that
it is available.

Revised Guidebook.mn is tested, Guidebook.tex is not.
2016-06-24 16:21:53 -07:00
PatR
02db340cd6 spell lint
Mark an unused function argument as UNUSED.  Also, hurtle_step is
the recoil from throwing or kicking while levitating, which isn't
related to the recently added spellcasting line-of-sight check, so
rename spell_hurtle_step to spell_aim_step.
2016-06-23 06:21:58 -07:00
PatR
1f787c077b tiles lint
FDECL(foo, (boolean)) ought to have been using (BOOLEAN_P), but
the tiles code isn't including the header which defines that, so
change the argument to int.
2016-06-23 06:19:45 -07:00
Pasi Kallinen
030e3c0dfd Use the graymapping stuff in the tile lib 2016-06-23 10:15:55 +03:00
Pasi Kallinen
5f35d49105 X11: Make statue tiles look like grayscale monsters 2016-06-23 09:44:07 +03:00
keni
7feb3ad948 Merge branch 'NetHack-3.6.0' of https://rodney.nethack.org:20040/git/NHsource into NetHack-3.6.0 2016-06-22 19:29:14 -04:00
keni
ce26d2616d add docs for the cmdhelp conditionals 2016-06-22 19:28:23 -04:00
Pasi Kallinen
f32a9778b2 Unify mon throwing missile collision check 2016-06-22 21:59:29 +03:00
PatR
dc6827ce12 more monkeys
My old monkey patch was a bit more extensive than Pasi's, although
it didn't originally include letting apes be tameable with bananas.
No sense in throwing it away:
1) Make monkeys and apes be omnivores instead of carnivores.
2) Make bananas be preferred food for herbivore/omnivore subset
   of Y-class, so excludes carniverous ape, owlbear, and yeti.
   [Sasquatch remain omnivorous but aren't tameable with bananas.]
3) While updating befriend_with_food(), make horses be affected
   only by food they might eat, not by meat and corpses and tins.
   So they'll be somewhat harder to cope with for characters not
   strong enough to kill them.  [Dogs and cats are unchanged.]

Not included (not even implemented...):
0) Allow archeologists to choose monkey for starting pet.
   [The one in "Raiders of the Lost Ark" didn't actually belong
   to Indiana Jones but spent a lot of time accompanying him.]
2016-06-21 17:32:02 -07:00
Pasi Kallinen
d015cbec15 Silence some compiler warnings 2016-06-21 14:14:54 +03:00
Pasi Kallinen
9ff069ed19 Add fixes entries for my commits 2016-06-21 13:18:05 +03:00
PatR
4697c13db0 '$' vs #jump
Hero poly'd into xorn can wear jumping boots or cast jump spell, so
some target destinations which were excluded by '$' (to show valid
destinations during getpos) shouldn't have been.  Doubly so if
wearing the Eyes of the Overworld where xorn'd hero can jump through
walls rather than just into them.

This attempts to deal with diagonal moves vs open doorways sanely,
including allowing knight's move jumps in or out of them when
appropriate.

Also, need to check isok(x,y) before cansee(x,y) instead of after.
2016-06-21 02:39:21 -07:00
Pasi Kallinen
d91d445fc6 Fix compiler warning 2016-06-20 13:21:22 +03:00
Pasi Kallinen
53e8869a16 Cannot tame carnivorous ape with bananas 2016-06-20 13:05:01 +03:00
Pasi Kallinen
16118580d5 Tame simians with bananas
Bananas are quite rare, and none of the simians are very strong,
so this won't be in any way overpowered - just a bit of flavor.

I think this was originally Derek's change from Sporkhack, but
similar ones have been done in the community multiple times
in the past.
2016-06-20 12:56:58 +03:00
Pasi Kallinen
3eb919d5ab Fix #H4411: Targeting detected monster through wall with fireball
Fireball and cone of cold could target detected monsters
through a wall when cast at skilled or higher.  This allowed
eg. targeting the Wiz from outside his tower.

Use walk_path to determine the actual location where the
spell will hit, so trying to cast through a wall will
make the explosion happen at the nearest empty space.
2016-06-20 09:11:56 +03:00
PatR
1cad5efe17 fix #H3723 - eating "YUM YUM" scroll
From November, 2014, player thought eating a scroll labeled YUM YUM
while polymorphed ought to give a special message.

While implementing it, I noticed that if a g.cube managed to get on
to a spot containing a scroll of scare monster, it would eat that
along with everything else.
2016-06-18 15:38:00 -07:00
Pasi Kallinen
7c117908c5 Merge branch 'bobbydurrett-mailenvfix' into NetHack-3.6.0 2016-06-18 20:39:22 +03:00
Pasi Kallinen
bb87745142 Merge branch 'mailenvfix' of https://github.com/bobbydurrett/NetHack into bobbydurrett-mailenvfix 2016-06-18 20:37:34 +03:00
PatR
37c4655722 fix #H4404 - Orc wizard vs ring of poison resist
Orcs are innately poison resistant, so orcish wizard's random ring
shouldn't be poison resistance.  Presumeably an orc who is bright
enough to become a wizard is not so dumb as to bring a useless ring
with him/her into the dungeon....
2016-06-17 16:30:50 -07:00
PatR
1af081edc5 fix #H4388 - wishing conduct inconsistency
Make wishing for an artifact and not getting it because it already
exists break never-wished-for-artifact conduct.  The wish was made
even if the result wasn't what the player wanted.
2016-06-16 22:01:27 -07:00
PatR
2c8a359feb fix #H4401 - grammar bug when hallucinating
You kill poor goblin.
"poor" implies a pet; pet has a name; "the" is omitted for named
creature; hallucination suppresses name, so "the" needs to be
reinstated.
  You kill the poor goblin.
2016-06-16 17:39:00 -07:00
PatR
1f4574b6c8 lycanthropy tweaks
Make it be cannabalism for a were<foo> to eat a <foo> corpse.

Let werejackals summon foxes and coyotes in addition to jackals,
and werewolves summon wargs in addition to wolves and winter wolves.
2016-06-16 17:11:25 -07:00
PatR
09326f03bf cmdhelp build bug
dowhatdoes_core() was using iflags.altmeta unconditionally but
its availability and usefulness is conditional upon #if ALTMETA.
2016-06-16 00:01:06 -07:00
PatR
93dbc7216a config file typo 2016-06-15 23:58:21 -07:00
PatR
bc8e613719 engulfer tuning
Reported by me ;-} during beta testing last Fall, engulfers have a
tendency to re-engulf the hero immediately after expelling him/her.
Use mspec_used (set when expelling rather than engulfing) to make
them wait a turn or two.  Initially that made the too-soon engulf
attacks always miss, so this changes too-soon engulf to a touch or
claw attack instead.  Some tuning in damage or message may be needed.
2016-06-14 17:37:44 -07:00
PatR
7e257dc7e8 eating off floor while blind
Reported directly to devteam in late December, when blind and
lacking gloves, you could safely locate cockatrice corpses on the
floor by using 'm' prefix to move without pickup followed by 'e'
and then answering no when ask whether to eat a cockatrice corpse.
2016-06-14 16:43:03 -07:00
PatR
b47a456630 feedback for failed movement attempts
When underwater and an attempt to move onto adjacent land fails
because the destination is a wall or solid rock or closed door,
report that there's an obstacle instead of just silently failing
to make the move.

If the user has 'mention_walls' option set, give feedback for
failing to move diagonally into or out of a doorway instead of
just silently not moving.

Having 'mention_walls' set could yield "you cannot pass through
the bars" when travel was testing (not moving) for a path past
iron bars, and when it happened it tended to be delivered a whole
bunch of times.
2016-06-13 17:46:34 -07:00
Pasi Kallinen
8fdd2318c1 Change deserted temple ghost messages 2016-06-13 11:25:34 +03:00
Pasi Kallinen
942ee14d0f Move generic usernames to sysconf 2016-06-13 11:01:05 +03:00
Pasi Kallinen
3f5116fbd4 Add more hallu liquids 2016-06-13 10:26:13 +03:00