Commit Graph

4944 Commits

Author SHA1 Message Date
PatR
ad3af4efb2 hacklib.c formatting
hacklib.c took a beating in the reformatting, so clean it up.
A tweak to the anti-predictability hack in setrandom() is the only
change in the actual code.
2015-05-27 03:49:09 -07:00
PatR
eeb69bfe09 omit_buc tweak
gcc complained about mixing && with || without parantheses.  After
scratching my head a bit, I think this change yields the intended
result.

'omit_buc' is a bad option name.  It's cryptic and it doesn't even
describe the function.  At a minimum it ought to be changed to
'omit_uncursed' to accurately describe what it does.
'implicit_uncursed' or 'explicit_uncursed' (with opposite boolean
value) would be even more precise but probably not any clearer.
2015-05-27 03:35:28 -07:00
Pasi Kallinen
5fabcdf692 Add omit_buc -option
The option defaults to on, which is the old-style behaviour.
Turning the option off will never omit the "uncursed" -status
from inventory lines. This is pretty much required if users
want to use menucolors based on the BUC state.
2015-05-27 12:46:35 +03:00
Derek S. Ray
a65c568e49 New precompiled versions of these 2015-05-26 22:54:55 -04: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
2174d26c47 More wishing nits. 2015-05-26 09:06:41 +09:00
Sean Hunt
58052f88ad Count only stacks when listing container contents.
By popular demand of the beta testers.
2015-05-26 09:04:04 +09:00
Sean Hunt
9c827ad231 Provide feedback when one of your items gets wet. 2015-05-26 09:00:33 +09:00
PatR
fca75c5766 questpgr.c's in_line[], out_line[]
Replace static in_line[] and out_line[] with local variables that are
released when the quest pager code returns to caller.  QTEXT_IN_SIZ
was already removed from makedefs; now QTEXT_OUTSIZ is removed from
nethack.  Use regular BUFSZ for them instead of trying to maintain a
separate size for quest text.
2015-05-25 15:49:44 -07:00
PatR
dfd9586ab4 wishing bit - royal jelly 2015-05-25 14:54:48 -07:00
Pasi Kallinen
29ecd78efc Fix squeaky board creation segfault
If a trap is created on top of another trap, maketrap reuses
the trap struct in place, instead of deleting and recreating it.

If a squeaky trap was created on top of another trap, maketrap
first set the trap type to squeaky board, and then tried to
look through all squeaky boards on the level, to determine
what note the new trap should play. Unfortunately, the union
with the trap note most likely contained a rolling boulder
coordinate or something else outside the 12 note range, so
then the tavail-array lookup would cause a segfault.
2015-05-25 22:03:04 +03:00
Pasi Kallinen
fd1932075e Fix dark room glyphs on level re-entry 2015-05-25 10:02:09 +03:00
PatR
911745a5ea trickier lint cleanup
Suppress some mostly longstanding "unused parameter" warnings where
the usage was generally conditional.

restlevl() had a conditional closing brace that confused the recent
reformat, resulting in some code inside a funciton ending up flush
against the left border (first column, that is, as if outside of the
function).
2015-05-24 23:49:05 -07:00
PatR
49c997c22c makedefs lint
makedefs.c: In function 'fgetline':
makedefs.c:2630: warning: comparison between signed and unsigned
makedefs.c: At top level:
makedefs.c:2638: warning: ISO C does not allow extra ';' outside of a function

fgetline() makes my recent check for quest line truncation become
redundant, so strip that out.  I haven't taken the corresponding
macro out of qtext.h though.

[I didn't see any patch introducing 'fgetline'.  Was it hidden as
part of some big merge?]
2015-05-24 23:26:35 -07:00
nhmall
53363e05b9 add missing tile and correct clobbered header file 2015-05-24 21:10:22 -04:00
Sean Hunt
6df9d25a09 Add clang-formatting file.
This should be in the repository, even though nobody can use it yet.
2015-05-25 09:21:31 +09:00
Sean Hunt
1c081b1647 Remove stale version control lines. 2015-05-25 09:21:31 +09:00
Sean Hunt
8b57d96fd2 Reformat .h files.
I did my best to exempt some of the bigger aligned blocks from the reformatting
using the /* clang-format off */ and /* clang-format on */ tags. Probably some
that shouldn't have been formatted were anyway; if you encounter them, please
fix.

The clang-format tags were left in on the basis that it's much easier to prune
those out later than to put them back in, and it means that, modulo my custom
version of clang-format, I should be able to run clang-format on the source tree
again without changing anything, now that Pat has fixed the VA_DECL issues.
2015-05-25 09:21:15 +09:00
Sean Hunt
26ee7dc370 Convert the vibrating square to a trap
Patch due to ais523 in NetHack 4.

This is not ready to be merged yet; the vibrating square needs a tile
image for tiles builds.
2015-05-25 09:19:20 +09:00
nhmall
0e1a0d9bd9 remove #include of file that doesn't exist 2015-05-24 19:29:20 -04:00
nhmall
db2b1453bc fix a mistake on patch merge
Changes to be committed:
modified:   util/makedefs.c
2015-05-24 19:17:05 -04:00
Sean Hunt
b6f32e7eff Warning cleanup. 2015-05-24 11:12:58 -04:00
Sean Hunt
b8bea3af20 Make the wand of wishing chest immune to trapping
This eliminates a source of very random, unpreventable frustration to
players.
2015-05-24 11:12:41 -04:00
Sean Hunt
b5513b7db0 Make long worms unleashable.
Fixes a bug reported by ais523. Rather than account for individual
segments, I opted just to make them unleashable, because it's not very
useful behaviour anyhow.
2015-05-24 11:12:27 -04:00
Sean Hunt
4cd43fdaa2 Clean up ceiling nits.
Fixes C343-102.
2015-05-24 11:12:12 -04:00
nhmall
77eb56b7b6 Files update 2015-05-24 10:30:55 -04:00
nhmall
194fd2f78c merge two sets of patches to makedefs.c,qtext.h
Changes to be committed:
	modified:   include/qtext.h
	modified:   util/makedefs.c
2015-05-24 10:27:03 -04:00
Sean Hunt
cc50ecda67 Provide documentation for the regex engine.
The guidebook entries could do with more detailed descriptions, but this
will do for now.
2015-05-24 10:19:32 -04:00
Sean Hunt
84d63e169b Use the common regex engine in more places.
In particular, in autopickup_exceptions and user sounds.
2015-05-24 10:17:58 -04:00
Sean Hunt
49b9f6c926 Modify makedefs to use dynamic buffers for reading.
This will prevent crashing due to excessively long lines.
2015-05-24 10:17:28 -04:00
nhmall
f477645774 prep for sean's emailed patch 2015-05-24 10:16:38 -04:00
nhmall
57e404250a prep for sean's emailed patch 2015-05-24 10:09:44 -04:00
Sean Hunt
44f4bc240c Add pmatch-based regex engine.
As mentioned, this is not tested. It should be simple though.
2015-05-24 09:42:56 -04:00
Sean Hunt
a67759cbc3 Audit rloc()
Most of the time, rloc() is used for teleporting monsters and it's not a
big deal if they can't find somewhere to go. In a few cases, it is. I
went through all the callsites and made calls to rloc() not cause
impossible()s if they don't need to.

Fixes a bug/suite of bugs reported by ais523.
2015-05-24 09:31:40 -04:00
Sean Hunt
80703597c0 Clean up a rare corner case with mnearto().
With this fix, if the second mnearto fails, we don't accidentally strand
othermon at (0,0).
2015-05-24 09:24:52 -04:00
Sean Hunt
6aaece4ba7 Fix sleep explosion causing impossible().
Also clean up come ternaries while I'm here.

My first attempt to fix was to add AD_SLEE to explode(), but that failed
because do_break_wand() already does the sleeping portion. I don't
generally like the duplication between explode() and do_break_wand as a
result, but I consider that issue a project for another day.
2015-05-24 09:24:11 -04:00
nhmall
137bc4a493 minor comment typo spotted
Changes to be committed:
	modified:   src/objnam.c
2015-05-24 08:17:32 -04:00
PatR
5f0a55f2cd makedefs -q fix
Make the input buffer for quest messages bigger so that the expanded
header line from nhsub won't be too long.  Also, makedefs will notice
and report too long lines ('makedefs -q' only) and sanely proceed with
the rest of the file instead of treating the excess part of a long
line as a separate line.
2015-05-23 23:11:41 -07:00
PatR
7bc1a6e7f3 quest summary messages for B and C
Add '%E [summary line]' to '%Cc' messages for Barbarian and Caveman.
Archeologist was done several years ago; the other roles still need
them.  Creating them is fairly tedious, but DEBUGFILES=questpgr.c
allows them all to be checked on turn 1 via ^P, a great improvement
since that first set.
2015-05-23 01:10:56 -07:00
PatR
ae78865da8 msghistory bandage
Have genl_putmsghistory() pass the message to pline() for the !restoring
case, so that quest summary lines are delivered as ordinary messages.
No effect on tty or win32, which have their own putmsghistory routines.
But for X11, which has a multi-line message window but no save/restore
implementation for its contents, this makes the quest summary lines
actually show up somewhere.  (I looked at maybe implementing
X11_getmsghistory() and X11_putmsghistory() but don't have the energy to
tackle it.)

Other interfaces which lack their own history save/restore will see the
quest summary messages too.  Presumeably they'll all have multi-line
history windows so the extra line won't be displacing the most recent
message.  If not, they'll essentially get the long quest messages twice,
once in full via popup window, then the one-line summary via pline.
2015-05-23 00:59:18 -07:00
PatR
905c21dbe8 qtdump() overhaul
When dumping quest messages at startup via DEBUGFILES=questpgr.c,
give a single message for each one, instead of a pline showing the
message number and delivery protocol followed by a popup message
window containing the text.  This puts the number and protocol info
at the start/top of the popup window, bypassing the pline (and the
extra --More-- given for tty).
2015-05-23 00:50:34 -07:00
nhmall
404e37633f beta info
Changes to be committed:
	modified:   src/version.c
2015-05-22 20:08:33 -04:00
nhmall
37c35bcc15 Guidebook accuracy
Changes to be committed:
	modified:   doc/Guidebook.mn
	modified:   doc/Guidebook.tex
2015-05-21 20:59:04 -04:00
nhmall
56266a0800 Merge branch 'master' of https://rodney.nethack.org:20040/git/NHsource 2015-05-21 20:46:58 -04:00
nhmall
43006357bd comment out experimentals 2015-05-21 20:44:32 -04:00
PatR
168572fd0d #terrain update
Make the post-3.4.3 '#terrain' command be more versatile by allowing the
player to choose between floor-only, floor+traps, and floor+traps+objects
so that it is possible to view known traps covered by objects or monsters
and remembered objects covered by monsters.  The extra explore mode and
wizard mode choices aren't affected.
2015-05-21 16:53:46 -07:00
PatR
f0370f5f86 you feel {a,an unexpected} draft
Move the message given when a monster digs through a closed door
or a secret corridor into a separate routine.  In theory, nethack
should determine whether there is a path between the new opening
and the hero's location in order to decide whether a draft can
be felt.  (I don't think anyone is likely to implement that--I'm
certainly not.  Checking whether the hero is in a room with no
breaches in its walls could at least catch being inside a vault.)

While at it, add some USA-centric puns about feeling the prospect
of imminent military conscription instead of air current if it
happens while hallucinating.
2015-05-18 18:25:44 -07:00
PatR
9e0e1ac5d1 remove accidentally added util/lev_main.i 2015-05-15 23:08:15 -07:00
PatR
fabf9cd901 VA_DECL/VA_END usage
Make the variadic functions look more like ordinary code rather than
have the function opening brace be hidden inside the VA_DECL() macro.
That brace is still there, but VA_DECL() now needs to be followed by
a visible brace (which introduces a nested block rather than the
start of the funciton).  VA_END() now provides a hidden closing brace
to end the nested block, and the existing closing brace still matches
the one in VA_DECL().

Sample usage:
void foo VA_DECL(int, arg)  --macro expansion has a hidden opening brace
{  --new, explicit opening brace (actually introduces a nested block)
  VA_START(bar);
  ...code for foo...
  VA_END();  --expansion now provides a closing brace for the nested block
}  --existing closing brace, still pairs with the hidden one in VA_DECL()

This should help if/when another round of reformatting ever takes place,
and also with editors or other tools that do brace/bracket/parenthesis
matching.

I had forgotten that there were variadic functions in sys/* and ended
up modifying a lot more files than intended.  The majority of changes
to those just inserted a new '{' line so that revised VA_END()'s '}'
won't introduce a syntax error.  A couple of them needed VA_END() moved
so that local variables wouldn't go out of scope too soon.  Only the
Unix ones have been tested.
2015-05-15 17:45:21 -07:00
PatR
dd62a6831f fix mdig_tunnel impossibility
Reported by the keymasher:  "stone at (48,8) is undiggable".  Bigroom 4
has a tree at that spot and the whole level is flagged as undiggable.
Undiggable trees were supported on arboreal levels (where their terrain
type is STONE rather than TREE), but not elsewhere.  Monster movement
uses IS_ROCK(), which is true for TREEs, but may_dig() uses IS_STWALL(),
which is false for TREEs so doesn't consider the location as being of
interest and fails to disallow digging.  But mdig_tunnel() bypasses
may_dig() and tests the NONDIGGABLE bit directly, disallowing digging.
(If this sounds confusing, it's a stroll in the park compared to the
code itself.  Apologies for the mixed metaphore.)

Digging away a secret corridor could leave rocks, which doesn't make
a whole lot of sense.  Now a monster's dig attempt will reveal the
location as a corridor instead.

This also moves an assignment out of a macro invocation where it was
inviting trouble if that macro gets modified.  And reorganizes an 'if'
to put cheaper tests sooner.
2015-05-13 17:54:26 -07:00