Commit Graph

2318 Commits

Author SHA1 Message Date
Pasi Kallinen
dba9aaf424 Unify ad_curs 2020-12-04 09:30:16 +02:00
Pasi Kallinen
d325e2cc60 Unify ad_blnd 2020-12-04 09:30:16 +02:00
Pasi Kallinen
607d1bcd96 Unify ad_tlpt 2020-12-04 09:30:16 +02:00
Pasi Kallinen
bfe773812e Unify ad_sgld 2020-12-04 09:30:16 +02:00
Pasi Kallinen
b7899ee014 Unify ad_acid 2020-12-04 09:30:15 +02:00
Pasi Kallinen
8a78c49fea Unify ad_elec 2020-12-04 09:30:15 +02:00
Pasi Kallinen
6abfe7e548 Unify ad_cold 2020-12-04 09:30:15 +02:00
Pasi Kallinen
6712876801 Unify ad_fire 2020-12-04 09:30:14 +02:00
Pasi Kallinen
cfd819f1c1 Unify ad_drli 2020-12-04 09:30:14 +02:00
Pasi Kallinen
518798d0d2 Unify ad_dren 2020-12-04 09:30:14 +02:00
Pasi Kallinen
6436ea1532 Unify ad_dcay 2020-12-04 09:30:14 +02:00
Pasi Kallinen
0d445a7a7c Unify monster-hits-monster 2020-12-04 09:30:14 +02:00
PatR
4d6a140d34 saving vs ball&chain
I started activating new program_state.saving and discovered that
saving of ball and chain could access freed memory.  The change
for the former and fix for the latter are mixed together here (but
easily distinguishable).

The saving flag inhibits status updating and perm_invent updating,
also map updating that goes through flush_screen().  That should
fix the exception triggered after an impossible warning was issued
during a save operation.  impossible() goes through pline() which
tries to bring the screen up to date before issuing a message.
During save, data for that update can be in an inconsistent state.

The code to save ball and/or chain when not on floor or in invent
(I think swallowed is the only expected case) was examining the
memory pointed to by uball and uchain even if saving the level had
just freed floor objects and saving invent had just freed carried
objects.  So for the usual cases, stale pointer values for uball
and uchain would be present and checking their obj->where field
was not reliable.
2020-12-02 06:29:58 -08:00
PatR
f8fcab3400 move 'g.restoring' to 'g.program_state.restoring'
Move the core's global restoring flag (not the same as main()'s
local resuming flag) to a more logical place.  Add a saving flag
in the process, but it isn't being set or cleared anywhere yet.
(Once in use it will probably fix the exception during save that
was just reported, but before that it would be useful to figure
out what specifically caused the event.)

The program_state struct really ought to be standalone rather
than part of struct g but I haven't made that change.

Removing an unused variable for wishing and some reformatting
that whent along with it got mixed in.  Removes some trailing
whitespace in sfstruct.c too.

Only lightly tested...
2020-11-30 11:40:21 -08:00
nhmall
0d6481ad8c spelling correction tidbit
Closes #415
2020-11-28 08:59:03 -05:00
Pasi Kallinen
fb188dc1aa Unify mfndpos monster movement flags 2020-11-28 12:49:18 +02:00
Pasi Kallinen
36d977f61f Unify HP loss and passing out from overexertion 2020-11-27 23:43:59 +02:00
Pasi Kallinen
bbb3d35252 Unify enlightenment self-knowledgeable effect 2020-11-27 19:59:16 +02:00
PatR
bb9df368af fix github issue #401 - roast/rust/rot in peace
This tries to fix the problem of the extra message when a tame
golem is completely destroyed (paper or straw golem burned, iron
golem rusted, wood or leather golem rotted) being issued at odd
times.  I basically punted on the visibility aspect since the
original logic was strange:  you had to be able to see both the
attacker's and defender's spots and at least one of those two
monsters.  Now mon-attacks-mon visibility requires that you be
able to see one of the two and if you don't see both, the unseen
one will be referred to as "it".  The "may the iron golem rust
in peace" message is independent of that and may be displayed
after "you have a sad feeling", but now that's intentional and
will refer to an unseen pet by name or monster type, not "it".

This needs a lot of testing and hasn't attempted to address
issue #402:  only some attacks that should compeletely destroy
a golem actually do so.  (So a hit by fire elemental against a
paper golem does, but passive fire counterattack when a paper
golem hits a fire elemental doesn't, nor does a wand of fire
or being hit by Firebrand.)

Fixes #401
2020-11-27 02:38:17 -08:00
PatR
8d91a9f764 more options help
"Name of your starting pet when it is a kitten" could be
construed as meaning that it will no longer apply once the
kitten grows into a housecat.  Use "if" instead of "when".

The 'other settings' were in alphabetical order except for
"status condition fields" which presumably started out as
"condition fields".  Move it into proper place for current
description.
2020-11-26 18:47:45 -08:00
nhmall
7c91c76265 remove a comma at the end of an enumerator list 2020-11-26 15:48:56 -05:00
PatR
b2199840cd options help
Add a few missing options to dat/opthelp (without worrying about
"if FOO was set at compile time").  No doubt there are lots of
others still missing.

Reword a few options in dat/opthelp and also in the dynamic help
derived from optlist.h, particuarly catname, dogname, horsename
whose descriptions have always been confusing or maybe confused.
2020-11-26 12:00:00 -08:00
PatR
ec153a27bd options help
The revamped options handling was't doing dynamic help properly.
After listing the booleans, it listed them again amongest the
compound options.  Since their description field is Null, that
could be a big problem.  sprintf(buf,"%s",NULL) on OSX produces
"(null)" but most sprintf()'s would probably crash instead.

The 'other' options (autopickup exceptions, menucolors, &c) were
not listed at all.  (I don't remember whether that was also the
case before the revamp.)  Now they're listed but not explained.

The 'msg_window' description was unhelpful; this replaces it.
A couple of others were longer than necessary so they've been
shortened.  The rest of optlist.h is reformatting wide lines.

Recently added 'safe_wait' option was included in the Guidebook
but not in dat/opthelp; add it.
2020-11-26 02:20:00 -08:00
PatR
2db51cf8bd fix #K3016 - kicking a bag of gold in a shop
Kicking a container that had gold in it took the gold amount
away from hero's credit or added to hero's debt, then didn't
give a refund if the container and its gold landed within the
shop.  Throwing behaved likewise, just less verbosely.

The problem is caused by addtobill() treating gold specially
and then subfrombill() not being able to perform a reverse
operation.  Actually, it may be possible for subfrombill() to
do that, but verifying all its uses is too much work.  This
moves the gold handling for drop+selling into its own routine
and adds calls to that for the throwing and kicking refunds.
The other calls to subfrombill() outside of shk.c appear to be
ok as-is.  (The calls inside that file are the ones that still
need evaluation if the gold handling is to move to there.)

bill_dummy_object() now uses the same o_id assignment for its
dummy object as split_object() does for its new partial stack.
I don't know whether the old code led to any price glitches.
2020-11-25 14:33:14 -08:00
Pasi Kallinen
229930e505 Fixes and sanity checks for monster undetected and trapped states
Adds sanity checks for mtrapped and mundetected states.

Fixes cases where those were left in wrong state.

1. Trapped monster (eg. a nymph) teleported out of a trap
2. Monster was hiding under ball or chain, which then got removed
3. While restoring a level, a zombie corpse revived while monster
   was hiding under it
4. A general case where the only object was deleted off floor and
   a monster was hiding under it

Monsters hiding under ball or chain will now get revealed when
the b or c are moved.
2020-11-24 19:37:43 +02:00
PatR
3e9d8f9aa5 'showscore' vs containers
When SCORE_ON_BOTL is enabled, you could tell how much gold is
inside a container with unknown contents by having 'showsore' On
and watching how much the score changed on the status line when
picking the container up.
2020-11-21 17:37:01 -08:00
PatR
03d7d64d15 create monster creating concealed mimic
From an old bug report (sent directly to devteam, June of 2017):
wand or scroll of create monster becomes discovered if it makes
a mimic that is concealed as an object or as furniture within
the hero's view.  Fixing this in the general case [when does
seeing a mimic as something other than a monster mean that the
mimic is being seen?] is a massive can of worms, but fixing this
specific case is trivial.
2020-11-20 18:56:35 -08:00
Pasi Kallinen
e100d1a137 More unpolyable unifying
... and fix the potion dipping case.
2020-11-17 18:00:43 +02:00
PatR
cb8baa1d1c Qt status overhaul: add support for 'statuslines'
Condense the Qt status slightly, moving Alignment field from the
Conditons line to the Characteristics line and the Time and Score
fields from their own possibly blank line to the HP,&c,Gold line.

That's for statuslines:2, which is the default.  statuslines:3
restores the previous layout.  I tried to make that become the
default for Qt but it got messy fast and I gave up.

I also tried to make changing 'statuslines' back and forth on the
fly work but failed.  I left the code in as #if DYNAMIC_STATUSLINES
but that isn't defined anywhere.  For the time being at least,
'statuslines' is config file or NETHACKOPTIONS only for Qt, not
changeable via 'O' like for curses and tty.

Change the option description for 'statuslines'.  That depended
upon whether curses was compiled in when it should depend on which
interface is active.  This moves the alternate info to Guidebook.
2020-11-17 05:07:09 -08:00
Pasi Kallinen
d81e1672aa Unify unpolyable objects to single define 2020-11-16 18:42:12 +02:00
PatR
5c291bc540 honor sysconf SHELLERS on VMS
I was looking into adding a confirmation prompt for '!' and it
isn't very promising due to sequencing issues.  (The check for
whether '!' is allowed should happen before the prompt about
running it but the latter should take place in the core rather
than in the port code.)  In the mean time, I noticed that VMS was
ignoring the SHELLERS value from SYSCF.

Untested implementation of a SHELLERS check on VMS.  Even if it
works, it should not be using $USER as the user name to verify.

Tweaks the Unix implementation of check_user_string() but doesn't
switch the testing loop to the simpler version used by VMS which
is derived from the generic users test used by Qt.
2020-11-15 18:28:20 -08:00
Pasi Kallinen
d6384f4061 Use enums instead of magic values 2020-11-15 19:32:21 +02:00
Pasi Kallinen
0dc44ad210 Update comment about xchar 2020-11-15 14:25:45 +02:00
Pasi Kallinen
deb730d9b5 More hypothetical type mismatches 2020-11-15 13:51:47 +02:00
Pasi Kallinen
289c8d654d Futureproofing hypothetical type mismatches
If we ever want huge maps with COLNO or ROWNO larger than signed char,
this will at least allow the game to compile and start when typedef'ing
xchar to int. Trying to use huge maps exposes more bugs.
2020-11-14 13:53:09 +02:00
Pasi Kallinen
6ec55a3624 Rework stairs structure
Use a linked list to store stair and ladder information, instead
of having fixed up/down stairs/ladders and a single "special" (branch)
stair.

Breaks saves and bones.

Adds information to migrating objects and monsters for the dungeon
and level where they are migrating from.
2020-11-13 20:27:17 +02:00
PatR
096511b509 github pull request #406 - polyfodder() macro
Some eggs and tins could cause an out of bounds index into the
mons[] array.  Post-3.6 bug: the faulty part of the test is only
relevant for 3.7 genetic engineer monster.  Earlier versions just
called pm_to_cham() which does it's own index validation.

Fixes #406
2020-11-05 16:03:05 -08:00
Pasi Kallinen
c9ac5bc48a Increase EDITLEVEL post Zombie Apocalypse
I forgot to increase EDITLEVEL, as the Zombie Apocalypse added a timeout
routine, messing up saves and bones.
2020-11-04 11:36:52 +02:00
PatR
c8d05ac352 ignitable() macro
ignitable() was excluding magic lamp and then every place that
used it did so as 'ignitable(obj) || obj->otyp == MAGIC_LAMP'
so just include magic lamp.

I noticed that while hunting for an explanation for report #K2734
where returning to a previously visited level triggered the
warning "begin_burn: unexpected eggs".  I've decided that the
zombie apocalypse is probably the cause.  It inserted a new type
of timer in the list of such but it didn't bump EDITLEVEL to
invalidate save and bones files which relied on indices into the
old list.  I'm not sure whether we should bump that now.
2020-11-03 14:25:06 -08:00
PatR
87b378bb33 more Amask2align()
Recent change to Amask2align() was only masking the shrine bit
off its argument some of the time.
2020-11-01 14:30:25 -08:00
PatR
8907a5df9c more alignment conversion
The overview code could reveal the true alignment of an altar
if hero saw a mimic pretending to be an altar on that spot, or
reveal junk for the alignment when mimicking at altar on some
other spot.

Avoid passing macros that might evaluate their arguments more
than once to other macros which might also do that.  The hidden
code expansion can easily get out of hand (although in this case
it was modest).

Also, get rid of the unused MSA_foo alignment values since two
of them had the values swapped.  Lastly, make Amask2align() more
robust in case a value with the shrine bit set gets passed to it.
2020-10-30 17:46:21 -07:00
Patric Mueller
7086427aaa Enable checkpointing again by default
This was accidentally changed in the options refactoring in commit 68fdc3bbcb.
2020-10-30 20:30:21 +01:00
nhmall
96ba25241c revert to numeric 2020-10-30 09:14:23 -04:00
nhmall
01c4a50f98 warning and a bit of alignment-related header consolidation 2020-10-30 09:08:23 -04:00
PatR
0e713dc4e9 fix #K2617 - metallivores eating iron bars
Monsters with rust attacks (rust monster) and corrosion attacks
(black pudding, gray ooze) can eat or otherwise destroy iron bars
but xorns could only move through the iron bars spot without being
able to eat the metal there.  Change xorn to eat bars instead of
phazing through them.  Lets rock moles eat bars too.

Hero polymorphed into a rust monster would eat bars if trying to
move to their location but couldn't do so if already there (maybe
was in xorn form and now in rust monster form).  Xorns could pass
through them but not eat them.  Allow hero metallivores to eat
bars at the current location via 'e', similar to eating food off
the floor.  Hero as rock mole behaves like rust monster.
2020-10-23 19:43:10 -07:00
Pasi Kallinen
aeb0ea65e3 Mild Zombie Apocalypse
When a zombie (or lich) kills a monster in melee without a weapon,
the monster can rise few turns later as a zombie.

The only creatures that can be zombified are ones that actually have
a zombie counterpart monster. A zombie cannot turn a jackal into
a zombie, for instance. But it could turn a shopkeeper into a human
zombie, or a dwarf king into a dwarf zombie.

Zombies will fight with monsters that can be turned into zombies.

Originally this was a SliceHack feature, but this is based on xNetHack
version of it, with some modifications.
2020-10-23 19:47:10 +03:00
Bart House
7e3a739ef9 Add stringization of nhassert expression. 2020-10-20 20:14:27 -07:00
Pasi Kallinen
566dde8683 Match object description via single function
making the code more readable.

Instead of doing strcmp(OBJ_DESCR(objects[otyp]), "foo"),
just call objdescr_is(obj, "foo")

(via xNetHack)
2020-10-20 19:19:57 +03:00
Bart House
93ce6857d3 Tweaks to nhassert implementation. Change to warnings on MSC build. 2020-10-19 15:55:32 -07:00
Bart House
3842da9dbd Added nhassert to core. 2020-10-19 15:51:41 -07:00