PatR [Tue, 15 Jan 2019 02:13:59 +0000 (18:13 -0800)]
potion mixing bit
Noticed when looking at whether alchemy ought to remove user-assigned
name. Get rid of the potion being dipped into sooner so that it won't
still be present if a perm_invent update takes place.
PatR [Tue, 15 Jan 2019 00:35:19 +0000 (16:35 -0800)]
level arrival
The check I added to make sure that a monster was at the hero's
coordinates before deciding to move one or the other would have been
confused by a long worm's tail. Check that they're at that spot but
not by comparing monst.<mx,my> coordinates with <ux,uy>.
Also, don't have wiz_makemap() assume that each level of the Wizard's
Tower has the same boundary coordinates. Keep track of whether hero
is inside that tower before discarding the old level.
PatR [Mon, 14 Jan 2019 17:28:10 +0000 (09:28 -0800)]
\#wizmakemap followup
Both u_on_rndspot() and losedogs() might result in having a monster
and the hero be at the same location. Have wiz_makemap() use the
same fixup for that as goto_level().
PatR [Sun, 13 Jan 2019 23:24:08 +0000 (15:24 -0800)]
\#wizmakemap update
The need for resetting lock picking when swapping in a new level made
me wonder whether other things should be reset too, and there were a
bunch: digging, travel destination, polearm target, being in water,
being swallowed or held, hiding. Hero placement was ignoring arrival
region. Also, it turned out to be pretty easy to fix the FIXME about
steed.
PatR [Sun, 13 Jan 2019 23:17:40 +0000 (15:17 -0800)]
blocking or unblocking levitation or flight
when level teleporting or digging. Level teleporting while levitation
was blocked due to being inside solid rock didn't notice that it should
be unblocked until you moved from whatever type of terrain you landed
on (room, for instance) to some other type (such as corridor). Digging
down to make a pit or hole while inside solid rock converts that spot
to floor so should also check whether to unblock levitation/flying, and
not fall if unblocking occurs.
PatR [Sun, 13 Jan 2019 01:43:52 +0000 (17:43 -0800)]
bz 406/#H4298 revisited
Redo the Ft.Ludios entry hack to suppress the lit walls on the left
and top rather than to light the upper-right corner. Only noticeable
if carrying a lit candle. Usually, that is. This simpler hack could
be detected visually from the treasure room side of the walls involved
but normally won't be.
PatR [Sat, 12 Jan 2019 03:08:02 +0000 (19:08 -0800)]
workaround #H4298/bz 406 - vision glitch
The entry chamber for the Fort Ludios level would be completely lit
except for one corner wall if you arrived carrying a lit candle. The
unlit spot turns out to be correct, it is beyond candle radius, but
spots further away than that were showing up lit. That's due to them
bordering a lit region on the opposite side and lit regions seem to
be bigger than their specified dimensions.
I tried to make the lit walls be unlit but it wasn't working. (Making
the lit region be smaller would probably work but might have unintended
consequences when populating the zoo room. I didn't try that.) This
makes the unlit corner show up if light hits the spot next to it, so
that it behaves like the other lit walls surrounding that entry area.
I haven't marked the bug report closed because I don't think this is
the proper way to fix this.
PatR [Sat, 12 Jan 2019 01:18:48 +0000 (17:18 -0800)]
enum values
Give the enum lists in several header files explicit values. Adding
or removing new entries will be more tedious, but doing that is rare
and being able to grep the headers for numeric values in addition to
names is very useful.
rm.h also has a bunch of tabs replaced with spaces.
PatR [Thu, 10 Jan 2019 11:10:35 +0000 (03:10 -0800)]
SEDUCE=0
When SEDUCE is disabled, instead of swapping attacks in mons[] once,
do it on the fly in getmattk() whenever needed. That allows mons[]
to become readonly, although this doesn't declare it 'const' because
doing so will require a zillion 'struct permonst *' updates to match.
This seemed trickier than it should be, but that turned out to be
because the old behavior was broken. Setting SEDUCE=0 in sysconf or
user's own configuration file resulted in all succubus and incubus
attacks being described as monster smiles engagingly or seductively
rather than hitting (while dishing out physical damage). I didn't
try rebuilding 3.4.3 to see whether this was already broken before
being migrated to SYSCF.
PatR [Thu, 10 Jan 2019 02:18:11 +0000 (18:18 -0800)]
characteristics loss
A hero run by the fuzzer that has characteristics plummet to 3 and
then sometimes hang around there instead of being recovered by restore
ability is happening because loss that tries to reduce the base value
below 3 lowers the max (peak) value instead, and once that also gets
down to 3, restore ability is no longer able to do anything with it.
This changes an attempt to reduce a characteristic by N points below 3
to reduce it by rn2(N + 1) instead. That's N/2 on average and a 50%
chance to be 0 when N is 1, so the peak value reached doesn't plummet
to 3 quite to quickly. It can still drop to that though.
There is a pull request dealing with simplifying attribute handling
and part of it affects the code being changed here, but the bit of
simplification included in this patch doesn't use it.
PatR [Thu, 10 Jan 2019 02:10:55 +0000 (18:10 -0800)]
hero infravision
Take a first step towards making the mons[] array be readonly.
The only other place that updates it is when changing succubus and
incubus AD_SSEX attacks to AD_SEDU ones and that can be handled
via existing getmattk(), but so far has proven to be trickier than
anticipated.
PatR [Wed, 9 Jan 2019 09:13:01 +0000 (01:13 -0800)]
make zeroany, zeromonst, zeroobj 'const'
They're never modified. Minor complication: &zeroobj is used as
a special not-Null-but-not-an-object value in multiple places and
needs to have 'const' removed with a cast in that situation.
PatR [Tue, 8 Jan 2019 22:42:54 +0000 (14:42 -0800)]
travel targetting via keyboard
Some phrase substitution in getpos() or its helpers produced
``Pick a target interesting thing in view for travel''
for 'm _', which sounds pretty awkward. Change that to be
``Pick an interesting thing in view for travel destination''
leaving "target" implied.
For plain '_', typing '!' yielded
``Using a menu to show possible targets.''
but then nothing happened. Change that to be
``Using a menu to show possible targets for 'm|M', 'o|O', 'd|D',
and 'x|X'.''
to explain when a menu will actually appear.
PatR [Mon, 7 Jan 2019 04:59:20 +0000 (20:59 -0800)]
stale vptrs for obj->{nexthere,ocontainer,ocarry}
'struct obj' contains a union of mutually exclusive pointers, but
removing an obj from a list wasn't clearing whichever one had been
in use. If something is removed from a monster's inventory, clear
the object's pointer back to that monster; if something is removed
from a container, clear the object's pointer back to that container;
and whenever something is removed from the floor, clear the pointer
to the object which followed it at that floor location.
PatR [Sun, 6 Jan 2019 10:36:41 +0000 (02:36 -0800)]
get_cost_of_shop_item() crash
More shop price determination fallout. After the most recent change
to get_cost_of_shop_item(), using ':' inside an engulfer carrying at
least one item while inside a shop would try to follow the item's
obj->ocontainer back-link and crash when that led to the engulfing
monster rather than to a container.
PatR [Sat, 5 Jan 2019 11:21:39 +0000 (03:21 -0800)]
fix #H7865 - shop prices for container contents
The recent attempt to have looking inside a container show shop
prices had multiple problems. Worst one was showing shop prices as
if the hero would be buying for items already owned by the hero.
Item handling inside containers on shop floor was inconsistent: if
shop was selling those items, they would include a price, but if not
selling--either already owned by hero or shopkeeper didn't care about
them--they were only marked "no charge" if hero owned the container.
This is definitely better but I won't be surprised if other obscure
issues crop up. Gold inside containers on shop floor is always owned
by the shop (credit is issued if it was owned by the hero) but is not
described as such.
PatR [Sat, 5 Jan 2019 03:03:34 +0000 (19:03 -0800)]
options.c formatting; glob as named fruit
This started out removing one tab and I got carried away. It moves
some labels to column 2, removes some parentheses where sizeof is
used on strings rather than types, adds or revises several comments,
replaces a couple of 'while' loops which can be simplified as 'for'
loops, and updates named fruit handling.
"glob of black pudding" became "candied glob of black pudding" if used
as a fruit name, but "small glob of black pudding" was used as-is and
became indistinguishable from an actual small glob. Unless you had
more than one; then you could try to check whether they merged into a
stack or coalesced into a bigger glob (but if neither of those changes
happened, you still couldn't tell which was the glob and which was the
named fruit).
PatR [Sat, 5 Jan 2019 02:28:50 +0000 (18:28 -0800)]
'm ^T' menu fix
Fix fuzzer feedback. The new wizard mode ^T menu had an early return
which bypassed destroy_nhwindow(), leaving the menu around. Fuzzer
eventually got "No window slots!" panic from tty. Make sure that the
menu window is torn down fully before returning.
Also, make the normal wizard mode teleportation chioce be preselected
so that not picking anything doesn't lead to an early return any more.
ESC still does though.
PatR [Fri, 4 Jan 2019 01:37:00 +0000 (17:37 -0800)]
fix github #172 - ^T inconsistencies; add m^T
Fixes #172
Casting teleport-away via ^T used different requirements for energy,
strength, and hunger than casting it via 'Z'. The strength and hunger
requirements were more stringent, the energy one more lenient. When
it rejected a cast attempt due to any of those, it used up the move,
but 'Z' didn't.
When testing my fix, I wanted an easier way than a debugger to control
how ^T interacts with wizard mode, so finally got around to a first
cut at being able to invoke it via wizard mode but not override those
energy/strength/hunger requirements. It uses the 'm' prefix to ask
for a menu. 'm^T' gives four options about how to teleport. (There
are other permutations which aren't handled.)
Also noticed while testing: ^T wouldn't attempt to cast teleport-away
if you didn't know the corresponding spellbook. 'Z' will attempt that
because it is possible to forget a book and still know its spell.
PatR [Wed, 2 Jan 2019 22:20:53 +0000 (14:20 -0800)]
sortloot vs gems
Some object classes (such as armor and weapons) are split into
"subclasses" when sortloot applies an ordering (for armor, all helms,
then all gloves, then all boots, and so on). Give gem class subsets.
Simple (1) valueable gem, (2) worthless glass, (3) gray stone, (4) rock
would give away information; instead, factor in discovery state and use
(1) unseen gems and glass ("gem")
(2) seen but undiscovered gems and glass ("blue gem"),
(3) discovered gems ("sapphire"),
(4) discovered glass ("worthless pieced of blue glass"),
(5) unseen gray stones and rocks ("stone"),
(6) seen but undiscovered gray stones ("gray stone"),
(7) discovered gray stones ("touchstone"),
(8) seen rocks ("rock").
If everything happens to be identified, the simpler ordering happens
(via 3, 4, 7, and 8) because the other subsets will be empty.
PatR [Wed, 2 Jan 2019 21:42:45 +0000 (13:42 -0800)]
create_particular long worm tail vs mkclass
Similar to ^G of 'I' triggering impossible "mkclass found no class 35
monsters", using a leading substring of "long worm tail" (other than
"l" and "long worm") would trigger impossible "mkclass found no class
59 monsters and kill the fuzzer when it escalates impossible to panic.
Tighten up the substring matching.
^G of '~' wasn't affected; it deliberately creates a long worm rather
than the tail of one. But it was possible to ask for "long worm tail"
as a specific monster type and then override the switch to long worm
when prompted about whether to force the originally specified critter.
I've added a check to prevent that opportunity to override even though
a tail without a head seemed to be harmless.
PatR [Tue, 1 Jan 2019 00:48:14 +0000 (16:48 -0800)]
tweak the Astral Plane level
Even out the difficulty (from one game to another) somewhat. Instead
of a 75% chance that two large areas will be opened up on the left
and right sides of the arrival area plus 13.5 (avg) * 1.5 (avg) extra
monsters in that region, change to 60% chance that the left side will
be opened up with 7 (avg) * 1.5 (avg) extra monsters and a separate
60% chance that the right side will be opened up with 7 * 1.5 (avg)
extra monsters. The chance that both sides get opened up drops to
36% but the chance that neither side gets opened drops to 16%, with
difference made up by 24% chance each for just one side or the other.
I was a little surprised that this actually worked. I hope there's
a less clumsy way to have a loop index.
PatR [Sun, 30 Dec 2018 23:30:38 +0000 (15:30 -0800)]
'O' vs bouldersym
The 'O' handling for bouldersym was updating the display value for
boulder even if the value had been rejected, and if it still had the
default of '\0', the map would end up with <NUL> characters. (When
examined via '//' or ';', those matched dummy monster class #0 and
led to the impossible "Alphabet soup: 'an("")'" that was suppressed
yesterday.)
Attempting to set bouldersym to ^@ or \0 would also be rejected as
duplicating a monster symbol. That is now accepted and used to reset
the boulder symbol to default. However, other control characters are
also accepted--not due to this patch, they already are, and from a
config file in addition to via 'O'--so bouldersym can still disrupt
the map. But that's no different from putting control characters
into a symbol set or setting them from config file via S_foo:^C.
PatR [Sun, 30 Dec 2018 04:41:16 +0000 (20:41 -0800)]
minor memory leak
I ran the fuzzer with MONITOR_HEAP enabled and heaputil found a dozen
or so un-free'd allocations, all made by the same dupstr() call in
special_handling() for "symset" and "roguesymset". (Reproducible with
a few tens of thousands of fuzzer moves, although you have to take
over from the fuzzer and make a clean exit rather than just interrupt
it or there'll be lots of other un-free'd memory.) I haven't actually
figured out how/why it was leaking, but reorganizing the code has made
the leak go away (according to a couple of even longer fuzzer runs) so
I'm settling for that.
PatR [Sun, 30 Dec 2018 04:39:11 +0000 (20:39 -0800)]
alphabet sour warning
A recently added impossible to check for an(Null) and an("") was
triggered by the fuzzer: Alphabet soup: 'an("")'. I reproduced it a
couple of times and tracked it do_screen_description(for '/' command)
matching the symbol from mapglyph to monster class #0, a placeholder
with symbol value '\0'. So mapglyph() returned a symbol of '\0', but
not necessary from showsyms[0 + SYM_OFF_M].
The pager lookup code's monster loop shouldn't have been attempting
to match against class #0, and since this fix I haven't been able to
reproduce the situation again. But I also didn't trigger it with a
bunch of temporary checks in mapglyph() so don't know what is really
going on under the hood.
PatR [Sun, 30 Dec 2018 02:38:30 +0000 (18:38 -0800)]
curses splash/copyright screen, role prompt
Back out '#include "date.h"' so that cursinit.c won't be recompiled
every time any other file(s) need to be compiled. It doesn't need
patchlevel.h either. There is already a straightforward way to fetch
the copyright banner lines from version.c.
The splash screen (ascii art spelling "NetHack" preceding the normal
copyright lines) was invisible when showing white text on white-ish
background. Make it honor !guicolor.
"Shall I pick a character's role, race, gender and alignment for you?
[ynaq] (y) " was too wide to accept the answer on the same line on
an 80-column display so "(y) " was placed on the second line. That's
constructed in the core; change the construction to omit " a" when
using "character" rather than a role name. (tty shortens it by omitting
the default " (y)"; with " a" gone, it could revert to normal prompt.)
Also a bit of lint cleanup and some reformatting of cursinit.c....
PatR [Sat, 29 Dec 2018 11:28:07 +0000 (03:28 -0800)]
X11 on OSX
The change to Makefile.src for X11+XPM on linux broke linking X11 on
OSX. This updates the hints files (except for the -qt one) so that
make WANT_WIN_X11=1
and
make WANT_WIN_X11=1 USE_XPM=1
work correctly.
The comment in macosx10.14 about what version(s) it's intended for
and been tested on is just cloned from 10.10 and should be updated.
Pasi Kallinen [Sat, 29 Dec 2018 05:19:18 +0000 (07:19 +0200)]
X11: default to XPM-format tile file and rip screen
People have been wondering how to change the tiles on the X11
version, and the old default of NetHack-specific binary tile data
isn't directly editable with image editing tools.
Also show in the #version info if xpm and graphic rip are enabled.
PatR [Sat, 29 Dec 2018 03:10:54 +0000 (19:10 -0800)]
create_particular 'I' vs mkclass
The revised mkclass() [actually new mkclass_aligned()] has an extra
check which didn't used to be there, and attempting to create a
monster of class 'I' with ^G triggered impossible "mkclass found no
class 35 monsters" which the fuzzer escalates to panic.
PatR [Fri, 28 Dec 2018 02:36:26 +0000 (18:36 -0800)]
fix github issue #170 - stacks of non-missiles
Fixes #170
Monsters never throw athames or scalpels but some fake player monsters
on the Astral Plane are given those. Since they're stackable the
quantity usually gets boosted but there's no point in having more than
one if they won't be thrown.
This could have been fixed by letting monsters throw those two items,
but I prevented the quantity from being boosted instead.
PatR [Thu, 27 Dec 2018 23:37:06 +0000 (15:37 -0800)]
stack merging vs shop pricing
When merging one stack into another and they have different obj->o_id
price adjustments, keep the o_id of whichever one commands the higher
shop price.
PatR [Thu, 27 Dec 2018 23:01:15 +0000 (15:01 -0800)]
stack splitting vs shop prices
I misread part of the original code and the revision introduced a bug
based on that. obj->o_id price variations are used for all types of
non-IDed items, not just non-glass gems.
PatR [Thu, 27 Dec 2018 22:12:48 +0000 (14:12 -0800)]
fix #H7103 - shop pricing
Player came across a stack of 2 gray stones in a shop and kicked one.
That one ended up with a different (in his case, lower) price once it
was separate. This behavior only applies to non-glass gems which add
a price variation derived from internal ID (obj->o_id) number. Make
splitting stacks always yield the same price per item in the new stack
as was being charged in the old stack by choosing a similar o_id. Do
it for all splits (that can vary price by ID, so just non-glass gems),
not just ones performed inside shops.
He picked up the lower priced one and dropped it back on the original
higher priced one; the combined stack took on the lower price. That
will no longer happen if they come from splitting a stack, but this
fix doesn't address merging with different prices when they start out
as separate stacks. (Unpaid items won't merge in inventory if prices
are different, but shop-owned items will merge on floor.)
PatR [Thu, 27 Dec 2018 21:31:42 +0000 (13:31 -0800)]
mines luckstone as achievement marker
It was possible to have the guaranteed luckstone at Mines' End become
merged with a random one and lose its specialness for achievement
tracking. Mark it 'nomerge' when created and clear that if/when the
achievement is recorded.
PatR [Wed, 26 Dec 2018 01:07:45 +0000 (17:07 -0800)]
container_contents() vs show goods
Fix another inconsistency with containers in shops: prices shown when
looking inside. Apply had them (because shop goods in containers are
flagged as 'unpaid' when hero carries the container), and loot did not
(because they aren't flagged that way).
PatR [Wed, 26 Dec 2018 00:45:41 +0000 (16:45 -0800)]
stolen_value() vs containers
stolen_value() treated hero-owned container holding shop-owned goods
as free for the taking.
The fix I'm working on which led to discovering this first added
stolen_value() then eventually stopped using it so I don't have an
example of where it is giving the wrong result.
PatR [Tue, 25 Dec 2018 21:48:51 +0000 (13:48 -0800)]
prices of items on shop floor
get_cost_of_item() was giving different information from shop #chat
when dealing with containers owned by hero containing objects owned
by the shop. And when it was legitimately reporting a price of 0,
doname_with_price() wasn't reporting 'no charge' for items inside a
shop that were owned by hero or that shopkeeper didn't care about.
Extend the shop price reveal to far-look, but only when hero and item
being examined are inside the same shop.
PatR [Tue, 25 Dec 2018 02:43:51 +0000 (18:43 -0800)]
status gold vs symset:Blank
Symset:Blank sets all the map symbols (except STRANGE_OBJECT) to
<space>. The status lines for !STATUS_HILITES force status to use '$'
instead of ' ' for the prefix before ":1234" for gold, but the status
lines for STATUS_HILITES did not. tty ended up with ":1234" for gold.
win32 and curses both ignore the prefix and construct their own, but
since win32 uses the map symbol for that it must also be ending up
with ":1234" (I assume; I haven't seen it). curses is forcing '$' for
the prefix, even on the rogue level.
This attempts to fix win32 without be able to test the result. I've
left curses alone.
PatR [Mon, 24 Dec 2018 10:08:44 +0000 (02:08 -0800)]
fix temporary strength loss that was permanent
Watching the fuzzer, I saw hero's strength plummet to 3 again and not
rise above 5 after that. It turns out to be due to life-saving, which
was fixing severe hunger but was not restoring the point of strength
that's lost when you go from hungry to weak.
Another fuzzer bit: the monk I was watching was bitten by a wererat
early on and was still inflicted with lycanthropy when he reached
level 19. (I've no idea how his level got to be so high; it jumped
from 14 to 19 while I wasn't paying attention.) Extend the earlier
hack for drinking a blessed potion of restore ability to recover lost
characteristcs to sometimes drink a potion of holy water instead.
PatR [Mon, 24 Dec 2018 01:25:14 +0000 (17:25 -0800)]
implement #H6051 - fake players resist Conflict
The rationale is that since the player character resists conflict,
fake players should too.
[I'm not sure that I buy that. Player character is always the one
*causing* conflict and it doesn't affect self. But this is simple
as long as no other resistance checks are against attack-by-ring.]
PatR [Sun, 23 Dec 2018 20:37:26 +0000 (12:37 -0800)]
fix #H6942 - dropx vs hold_another_object
Dropping an existing fragile item while levitating will usually
break it. Getting a new wished-for fragile item and dropping it
because of fumbling or overfull inventory never would.
Some callers of hold_another_object() held on to its return value,
others discarded that. That return value was unsafe if the item
was dropped and fell down a hole (or broke [after this change]).
Return Null if we can't be sure of the value, and make sure all
callers are prepared to deal with Null.
PatR [Sun, 23 Dec 2018 02:09:44 +0000 (18:09 -0800)]
fix github issue #155 - encumbrance vs water
Fixes #155
When drowning, you need to be unencumbered in order to crawl out of
water. When not drowing, you don't, but put a limit on how much can
be carried. If polymorphed into a swimming creature, allow stressed
or less; otherwise (magical breathing), burdened or less. (Doesn't
apply on the Plane of Water since there's no climb from water to land
involved.)
PatR [Sun, 23 Dec 2018 00:35:15 +0000 (16:35 -0800)]
fix #H7749 - "you detect it"
'Detect' is used for observing a vampire shape change without being
able to see the vampire. The problem here is that it changed from
bat form to fog cloud form in order to pass under a closed door,
and the message was being delivered when it was already at the door
location instead of before the move from a visible spot to that door.
I'm not happy with this fix, but any other alternative I considered
seemed to be worse. Having the shape change use up the monster's
move is probably a better way to go. Then on its next move it will
be in the right form to make a normal flow-under-door move.
PatR [Sat, 22 Dec 2018 01:11:22 +0000 (17:11 -0800)]
fix #H2709 - exercise_steed() for riding skill
Code appears to intend that riding for 100 turns be treated like a
successful weapon hit as far as skill training goes, but it was
actually requiring 101 turns each time. It's conceivable that that
was intentional, but unlikely.
PatR [Fri, 21 Dec 2018 22:36:55 +0000 (14:36 -0800)]
monsters on melting ice
Reported seven years ago, when ice melts underneath a monster, it
hovers there until its next move, then falls in and drowns. Dunk it
immediately, and give hero credit/blame if it happens during the
hero's turn (so presumably the melting was caused by the hero).
Also, let monster with teleport capability who gets dunked teleport
away from the water before getting wet, the way hero does.
PatR [Fri, 21 Dec 2018 09:14:45 +0000 (01:14 -0800)]
fix #H2680 - IDing unpaid gem should adjust price
Another one from 6.5 years ago, identifying a type of gem should give
a new price for any unpaid gems of that type and adjust shopping bill
accordingly. Report was for rubbing with touchstone and learning
worthless glass with price not changing until the learned 'gem' was
dropped. Fix works for that and also other forms of identification
(and for amnesia, raising prices of forgotten gems); no dropping is
required for the price to change.
Theoretically could apply to any type of item, but prices of gems are
by far the most sensitive to whether or not they're identified.
PatR [Fri, 21 Dec 2018 02:58:44 +0000 (18:58 -0800)]
data.base lookup bit
When testing the change to the Eyes of the Overworld wording and asking
for information about inventory item
k - a pair of lenses named The Eyes of the Overworld
I got "I don't have any information on those things". Not because that
item wasn't identified, but because the lookup was for "pair of lenses"
(finding nothing) and then for "The Eyes of the Overworld" (and not
finding it due to "The" which is stripped from the first attempt but
wasn't from the second nor present in the data.base key).
PatR [Fri, 21 Dec 2018 02:28:57 +0000 (18:28 -0800)]
fix #H6189 - Eyes of the Overworld database entry
The phrasing of the data.base entry for the Eyes of the Overworld
reads as if it is continuing some passage in a reference book, but
that comes off strange when using '/' to see it. Rephrase it.
data.base could stand to have an entry for 'lenses'....
PatR [Thu, 20 Dec 2018 01:52:49 +0000 (17:52 -0800)]
clang on OSX
The Unix Makefile.{src,utl} use the compiler name 'gcc' by default on
OSX, and that invokes clang which defines __GNUC__ to deal with gcc
extensions. But when invoked via the Xcode IDE, it evidently uses its
own name instead, and wasn't defining __GNUC__. tradstdc.h started
down the road of duplicating gcc features; switch to pretending to be
gcc instead.
PatR [Thu, 20 Dec 2018 01:36:14 +0000 (17:36 -0800)]
fix #H2582 - seemingly angry peaceful vault guard
Another one from nearly 7 years ago. Hero kicked embedded gold out
of a wall while following the guard away from the vault and got
"The guard calms down and picks up the gold."
and player thought it was odd because the guard was peaceful. It is
odd, but guards have an agitation state (0..7) when peaceful and it
is always non-zero when this event occurs. Suppress the "calms down"
part unless the agitation is close to making the guard turn hostile.
[Agitation is set to 5 after that event, so it isn't very calming.]
Also, the guard was picking up gold from underneath the hero while
two steps away. Move him adjacent (although it doesn't knock other
monsters out of the way if there's no room) prior to the message,
then back again after. That's how if works for gold that's not at
the guard's location and not at the hero's location, although that
case does knock another monster out of the way if one is on the gold.
PatR [Wed, 19 Dec 2018 22:52:23 +0000 (14:52 -0800)]
fix github issue #169 - monst vs vibrating square
Fixes #169
Monsters should not be afraid of stepping on the vibrating square
since it's only a trap for display purposes. [Perhaps they should
deliberately avoid it if the hero hasn't seen it yet, but I didn't
implement that.]
"You see a strange vibration beneath <mon's> <parts>." was strange
when <parts> was a wolf's "rear paws" or horse's "rear hooves"--was
the vibration magically skipping the front ones? And it sounded
naughty when it was a snake's "rear regions". If the creature has no
limbs or is floating or flying, just say "beneath <mon>"; otherwise,
if the part is "rear <something>", omit "rear ".
The message was weird in another way. Caller removes the monster
from it's old location and places it on the new one, calls newsym()
for the old location to show lack of monster, but then calls mintrap()
before newsym() for monster's new location (the trap's location). If
pline messages cause buffered map output to be flushed, the monster
will be missing during the time the messages are delivered. I fixed
that for vibrating square [seetrap()->newsym() before pline() rather
than after] but it should probably be fixed in the caller instead.
nhmall [Wed, 19 Dec 2018 11:43:00 +0000 (06:43 -0500)]
eliminate sys/share/pcsys.c from Windows build
Windows build was actually only using a single function
in there, so just add a similar function to sys/winnt/winnt.c
and eliminate the need for including sys/share/pcsys.c in
the build.
Another 6.5 year old report. This one from Steven Melenchuk told
how to reproduce C343-23 which is still open on our 'known bugs'
page. (I've no idea whether the original bug report came through
the contact page, and if so, what its assigned number was.)
I didn't try to solve this one, I just confirmed that it could be
reproduced and took the fix from grunthack at github. He didn't
menion a fix at the time but implemented one before abandoing his
variant. (Others kept it going afterwards; fix was during his time.)
The overflow occurred when the guard couldn't figure out where to
move to next and just repeatedly 'moved' to his current location
until the maximum number of fake corridor spots was used up. The
fix detects not knowing where to go next and explicitly choosing a
new destination.
Original problem could be reproduced by teleporting into the vault,
digging out a wall and two spaces of stone in a straight line, then
going back into the vault to wait for a guard. When he shows up:
answer, drop gold, follow. If the guard's path walks through both
dug spaces, he will stop waiting for the hero. But hero is in
between the guard and the gap in the vault wall and can't advance;
guard has reached a persistent corridor so doesn't know where to go
next. Have hero wait for 125-ish more turns and then game panicks.
The code was 3.4.3 vintage so needed thorough reformatting, but not
any actual changes (unless I've overlooked something).
PatR [Wed, 19 Dec 2018 03:11:36 +0000 (19:11 -0800)]
disable gcc's __attribute__((warn_unused_result))
Casting to (void) to discard a function return value doesn't satisfy
gcc's -Wunused-result (which we aren't enabling but is apparently
being activated for particular functions by glibc header files). Turn
it into a no-op to suppress three dozen warnings from Travis builds.
PatR [Tue, 18 Dec 2018 11:01:50 +0000 (03:01 -0800)]
life support for comatose code in explmu()
Static analysis notices that
if (physical_damage)
tmp = Maybe_Half_Phys(tmp);
will never pass the test because all code paths leading to it set
'physical_damage' to False. Instead of getting rid of it, add a fake
case that leaves that True.
PatR [Tue, 18 Dec 2018 10:44:21 +0000 (02:44 -0800)]
plug potential open file leak in checkfile()
Another item from static analysis. If an internal error ever caused
the "bad do_look buffer" warning from checkfile(), open file 'data'
would not be closed. (The bug in checkfile()'s caller which prompted
that check was fixed long go.)
An alternate fix would be to move the input buffer check to before
the file is opened, but verifying the file first seems worthwhile.
PatR [Tue, 18 Dec 2018 10:24:19 +0000 (02:24 -0800)]
remove dead code from parse()
From Jessie's old static analysis report. 'prezero' was used in 3.4.3
when processing a count for 'multi', but count handling is now done in
a separate routine and 'prezero' in parse() never changes value, so
get rid of it.