Commit Graph

53 Commits

Author SHA1 Message Date
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
PatR
16d8074352 lint 2015-04-22 19:17:49 -07:00
Pasi Kallinen
bd69677933 Unify stumbling on door mimic 2015-04-22 09:23:54 +03:00
Pasi Kallinen
35e0027328 Prevent out-of-bounds coords when closing a door 2015-04-15 19:43:53 +03:00
Pasi Kallinen
879f6d55c2 Add Auto open doors -patch 2015-04-13 21:11:44 +03:00
nhmall
f799bffbb2 Additional obstruction messaging fixup 2015-03-14 09:43:07 -04:00
nhmall
ece3385900 fix messaging in obstructed() in lock.c
From ais523's recent list of bugs:
If a long worm tail is blocking the door, and you're blind and not
telepathic, attempting to close the door marks the position of its head.

From an email received in late September 2014 before the git conversion:
> I was trying to close a door, not noticing that there was a garter
> snake there, and this message resulted:
> The garter snake stands in the way!
> I haven't tried it with any other monsters without feet, but
> "stands in the way" appears to be the wrong way to describe
> this situation...

Both of the above were found in the same function in lock.c
2015-03-13 22:27:09 -04:00
Pasi Kallinen
f2ab8f336b You_hear already checks deafness 2015-03-06 21:01:02 +02:00
Sean Hunt
ad82ca80f3 Make DUNGEON_OVERVIEW unconditional. 2015-02-27 19:33:20 -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
260f7ea860 Make TOURIST unconditional. 2015-02-27 19:33:12 -05:00
Sean Hunt
9e65758947 Make STEED unconditional. 2015-02-27 19:33:01 -05:00
keni
03140969ee Bulk recovery of file CVS headers and addition of NHDT- headers. 2015-02-26 09:19:03 -05:00
nethack.allison
5163e6dc20 remove line of unreachable code (trunk only) 2012-01-21 12:39:03 +00:00
keni
6520bbdca9 first try tonight: lock.c makemon.c 2011-12-30 23:10:37 +00:00
nethack.rankin
c34efb07bd mimic-as-door stealing key (trunk only)
Suggested by <email deleted> a month ago when he
reported that attempting to unlock a door which was actually a mimic
simply told the player that the door was not locked or that there was
no door.  He thought that mimic should take the key/pick/card away from
the hero.  This gives a 50% chance for the unlocking tool to be stolen
and become part of the mimic's inventory; it will be dropped when mimic
is killed.

     The theft routine has groundwork to be able to be used to take the
hero's wielded or thrown weapon when hitting, but the attack code doesn't
call it so that won't happen (and the theft code hasn't been tested under
that circumstance).  I'm not sure whether mimics should be able to grab
weapons, but g.cubes perhaps should, and if puddings could then "pudding
farming" [using a low damage iron weapon to split puddings, yielding tons
of experience, death drops, and #offer fodder when they're killed and
repeatable for as long as at least one pudding is kept healthy enough to
be split again] would become tougher to accomplish.  [The item drop and
corpse aspects have been toned down quite a bit since 3.4.3, but with
sufficient patience it is still possible to abuse.]
2011-02-03 21:49:36 +00:00
nethack.rankin
3b6c59c7fc more mimic-as-boulder (trunk only)
I started to add handling for doorways containing mimic-as-boulder
to doopen() and doclose() as was done for pick_lock(), but decided that
it was better just to prevent mimics from appearing as boulders at closed
door locations in the first place.  So the most recent pick_lock() change
and its fixes entry go away.

     This also fixes a post-3.4.3 bug.  On the top level of Sokoban I
discovered a boulder over a hole; probing reported it as a mimic with
0 hp.  The special level loading code moves mimic-as-boulder away from
trap spots by using place_monster() to put it on another spot, but it
was missing the corresponding remove_monster() to take it away from the
original location so left a stale pointer on the map.
2011-01-05 01:28:36 +00:00
nethack.rankin
e379b245d4 fix #H2154 - unlocking door blocked by mimic-as-boulder (trunk only)
Reported five months ago by <email deleted>,
the top level of Sokoban has mimics who pose as boulders and if one was
in a doorway (treasure zoo at final destination) you could still unlock
the door there without waking the mimic.  Yesterday's fix for unlocking
a door which was actually a mimic posing as one didn't handle this case.
2011-01-02 01:35:14 +00:00
nethack.rankin
1dcaa1621b fix #H2210 - unlocking a mimic masquerading as a door (trunk only)
From a bug report, attempting to use a key,
lock pick, or credit card on an open doorway that contained a mimic posing
as a closed door reported "that doorway has no door" or "you cannot lock
an open door" as if no monster was present, and failed to find the mimic.
2011-01-01 00:34:19 +00:00
nethack.rankin
97c2f8ef03 open/close/loot while confused or stunned (trunk only)
Fix a bug From a bug report:  while stunned he tried to close
an adjacent open door and when his choice of direction got changed to
some non-door spot, no time elapsed so he could just keep repeating the
attempt until eventually getting the correct direction.  Trying to open
an adjacent closed door and trying to remove the saddle from an adjacent
monster via #loot behaved similarly.  Applying keys and lock-picks also
did so in 3.4.3, but had already been changed to use up time in the dev
code.  There may be other actions which need fixing.
2010-02-02 23:10:01 +00:00
nethack.allison
19c795df8c Remove the old SCCS Id line from the files
... that were updated for dungeon_overview adjustment
2009-10-21 03:16:02 +00:00
nethack.allison
7c05c92eed dungeon_overview adjustment
The dungeon_overview bits in the rm structure were being
clobbered by a run-length encoding save/restore because
they weren't taken into consideration.

This patch pulls that data out of the rm structure completely.

It also adjusts the run-length encoding checks to take the
candig bit into consideration and adds a comment to rm.h
reminding people to make run-length encoding adjustments
in save.c for any new bits that get added.
2009-10-21 03:05:53 +00:00
keni
4eabcee787 Add RCS version lines 2009-05-06 10:50:32 +00:00
nethack.rankin
2d1eb28e67 aborting key/pick usage (trunk only)
From the newsgroup:  applying a key and then using ESC at direction
choosing prompt was using up a move even though hero didn't do anything.
2008-03-08 03:45:26 +00:00
nethack.rankin
44c1677ac1 open/close while blind (trunk only)
From a bug report, attempting to open or close
a door while blind didn't always update the map display after telling the
player that a remembered-closed door was already open or a remembered-open
door was already closed.  And in the cases where it did update the map to
reflect a change in door state, it didn't use up a turn.  Now always update
the display and use up a turn when 'o' or 'c' reveals any new information.
2007-11-16 06:53:23 +00:00
nethack.rankin
1c545eb678 drawbridge feedback (trunk only)
The open and close commands had some feedback when player attempted
to use them on a drawbridge, but they didn't handle all the permutations.
2007-08-03 01:49:33 +00:00
nethack.rankin
2feff50e33 lockpicking while engulfed
You can't begin or resume locking or unlocking a chest on the floor
while swallowed by a monster, but you could lock or unlock an adjacent
door in that situation.
2007-02-20 02:32:50 +00:00
nethack.rankin
4f528f2a7d #force fixes
Trunk and branch, noticed while working on an interface enhancement:
you could use #force to break the lock of a chest that's on the floor
while you're engulfed, also while levitating or mounted w/o riding skill.

     Trunk only:  refine an earlier fix that bills for breaking the lock
of a shop-owned chest.  The item which the hero is forced to buy showed
up in the bill as unlockable, which is accurate after the fact but didn't
reflect the shop's item.  Fix by billing for chest before altering it.
2007-02-18 05:54:15 +00:00
nethack.allison
19262b615b build warning (trunk only)
..\src\lock.c(184) : warning C4101: 'otmp' : unreferenced local variable
2007-01-05 23:12:27 +00:00
nethack.rankin
dccedb99ba breaking lock of shop chest (trunk only)
From the newsgroup:  you weren't charged anything if you broke the
lock of a box or chest which was owned by a shop.  Force the hero to pay
for the damaged container; any contents remain owned by the shop and don't
affect the cost of the forced purchase.  This existing entry in fixes35.0
is adequate to cover the fix:

various actions--such as enchanting--performed on an unpaid shop object
	either force the hero to buy the item (when its value is lowered) or
	increase the current bill (when its value is raised)
2007-01-03 03:58:31 +00:00
nethack.rankin
9315307df2 safe_qbuf, short_oname (trunk only)
Change safe_qbuf() so that instead of picking one of three strings
for sprintf() to plug into a prompt string, it actually constructs the
full prompt string itself.  Also pass in the unformatted object and a pair
of formatting functions instead of performing dual formatting in advance.
The actual formatting is done via new routine short_oname() which also
takes an object and a pair of formatting routines plus a target length.
It uses the first routine, typically xname() or doname(), and formats the
object, then if the result is too long it makes some transformations, and
tries again.  If truncating "called foo" and "named bar" down to 12 chars
and omitting "uncursed, rustproof, thoroughly corroded" attributes still
result in a string that's too long, it uses the other formatting routine.
The latter calls one of several jacket routines around simple_typename()
to produce a short result.

     This has been through about four incarnations now and has gotten a
bit less testing each time, but I need to get it in place before I end up
running out of gas and abandoning it.  I've got some changes to shk.c
(where safe_qbuf is needed but not currently used) that now need to be
redone and will come eventually.
2006-10-24 05:18:00 +00:00
nethack.allison
d09c374239 function pointer assignment warnings in VC2005
The latest Micrsoft compilers complain when a function is
assigned to a function pointer, and the function's argument
list does not match the prototype precisely.
It was evem complaining about the difference between this:
     int x()
     {
        [...]
     }
and a prototype of
     int x(void);
when assigning that function's address to a function pointer.

This quiets those warnings, without suppressing the mismatch
check altogether for more serious mismatches.
2006-06-25 19:54:31 +00:00
nethack.allison
354f4254bc wand of locking message (trunk only)
<email deleted> wrote:
> BUGS TO REPORT:
>
> * Zapping a wand of locking at an open door with an object on it probably
> shouldn't give a "Something's in the way." message - especially if the wand is
> unidentified.

avoid "Something's in the way" message with unidentified wand of locking
2006-03-08 23:08:25 +00:00
nethack.rankin
3d97eafe18 fix #H11 - forcing lock with mattock
From a bug report:  dwarvish mattock was
subject to breaking when attempting to force a lock, because it is treated
as a bladed weapon.  So is pick-axe; they're both defined as blunt (WHACK
attack mode), but the definition of is_blade() erroneously includes them
since P_PICK_AXE falls between P_DAGGER and P_SABER.  That skill should be
renumbered, but I haven't investigated what else might happen when that's
done so this fix uses a special case instead.

     I noticed that there was an unnecessary old check for rubber hose;
it's excluded along with whip by the skill > P_LANCE test.  When fixing
that up, I realized that the obscure feature of forcing via statue was
broken; it always failed the skill < P_DAGGER test.  Also, I took away the
exception for aklys; even though designed as a throwing weapon, it is used
as a club.  I wasn't sure about the exception for flail; it is perfectly
capable of bashing things but the code apparently excludes it for use as
a prying implement.  Switching its check to P_FLAIL catches grappling hook
along with it.
2006-01-03 05:28:13 +00:00
nethack.rankin
ff16502d67 floor access
A post-3.4.3 change dealing with reaching into pits resulted in "you
sit on the air" if you used the #sit command after escaping a pit trap.
Change can_reach_floor() so that caller explicitly controls whether being
on the brink of a pit is a condition that prevents reaching the floor.
This also splits a fairly common message about not being able to reach the
floor into a separate routine.

     There is still oddness here:  if you're polymorphed into a flyer,
#sit yields "you sit down" followed by "you fly over a pit" (latter occurs
when escaping trap activation).  A ceiling hider behaves similarly, but
the second message is "you escape a pit" and doesn't sound quite as silly.
Perhaps #sit should pass TOOKPLUNGE to dotrap(), or maybe there's some
better way to handle this?
2005-06-04 05:25:28 +00:00
nethack.allison
5fa8f73af8 housekeeping: mark trunk sources 3.5 (src) 2005-01-02 16:44:46 +00:00
nethack.allison
46fa48686b follow-up bit 2004-12-16 01:41:27 +00:00
nethack.allison
5a433fe0e0 new container flags
[Attention: This patch increments EDITLEVEL in patchlevel.h, rendering all
 previous save and bones files obsolete.]

Here's the first cut at the two recommended flags lknown and cknown.
I've attempted to stay close to Pat's recommendations:
   "Containers ought to have two new flags:  lknown for lock status known,
    and cknown for contents known (ie, `secret').  Formatted box and chest
    descriptions should include locked/unlocked/broken when that is known
    and empty/nonempty (or something like "holds N items") when contents
    are known. The contents indicator would also apply to nonlockable
    containers."

I probably overlooked a place where a flag should be adjusted, but this
should give us a good starting point.

I wasn't sure what to do with the case of the auditory feedback for
magical locking "Click" and "Clunk". The question that came to my mind
was: Should those reveal the locked or unlocked status of a box?
I suppose if you knew the type of wand you were zapping or the spell
you were casting, you could argue that they should.

In the end, I opted for setting lknown right off the zap/cast effect
for anyone playing a Wizard role, and not setting it for anyone else,
thus advancing class differentiation a little bit too.

I haven't checked the cknown results under all flags.menu_style options
at this point, only MENU_FULL.
2004-12-15 23:50:18 +00:00
kmhugo
e1f5ddd820 sound cleanup
+ Separate the two uses of flags.soundok.
+ Player-settable option is now called "acoustics".
+ Deafness is now handled as a full-fledged attribute.
+ Check for deafness in You_hear(), rather than caller.
+ Check for deafness in caller, rather than verbalize(),
  because gods can speak to characters in spite of deafness.
+ Since changes are being made to prop.h, reorder it to the
  same order as youprop.h and enlightenment.

There are still some extraneous checks and missing checks
for deafness, which will be followed up in a future patch.

Because of the size of this patch and its savefile incompatibilities,
it is only being applied to the trunk code.  Portions of this patch
were written by Michael Allison.
2003-09-28 03:42:50 +00:00
nethack.allison
22ce5ed6f2 trunk only: preserving context (src files)
Pat Rankin wrote:
> collect them all into some new struct and
> save that separately rather than jamming more non-option stuff
> into struct flags.

This patch:
- collects all context/tracking related fields from flags
  into a new structure called "context."
It also adds the following to the new structure:
- stethoscope turn support
- victual support
- tin support
2003-09-21 11:52:54 +00:00
cohrs
5e443536d8 "your" artifacts
This patch introduces a change to yname() and Yname2() that avoids the
possessive "your" for the hero's normal, fully identified artifacts.
Quest artifacts still get the possessive, as do all other objects and all
objects not in the hero's possession.  shk_your()/Shk_Your() are used in
many places with a specific, generalized name for the object, so I didn't
introduce the artifact behavior there, although I did change them to append
a space, which simplified some other code.  Through added use of yname(),
there may be some places that used to just say "corpse" that will now be more
descriptive via yname()'s use of cxname().  I'm sure <Someone> will point
out any such places that are too onerous, although nothing obviously is.

I took the opportunity to inspect many uses of "your" and even Your().  Two
new functions are also introduced, yobjnam() and Yobjnam2(), which work
like aobjnam() and yname() combined, because I found that many uses of
aobjnam() were preceeded by "your" and I couldn't generally provide the
desired behavior for artifacts (or future artifacts) without a combined
function.  In some cases, this change allowed better sharing of code.

rust_dmg() still takes a string as input which is sometimes initialized
from xname() and often prepends "your" to it.  Currently, this isn't a
problem since there currently are no normal, armor artifacts.  If/when any
are introduced, rust_dmg() will need to be addressed.

The patch is for the trunk only.  A lot of research was required and I
didn't feel the upside was there for repeating it in the 3.4.3 branch.
2003-09-18 02:52:40 +00:00
nethack.allison
416412f92b Remove vestiges of old overlay source split
[trunk only]
2003-09-05 02:45:18 +00:00
nethack.allison
6f56da5261 final qbuf patch
This is my final src mod to ensure that a qbuf does not overflow due to
a lengthy named object.  These recent patches, coupled with the core yn_function() patch earlier, should make it much rarer for a QBUFSZ
buffer overflow to occur in a window port routine (unless the window
port routine has its own bugs, but that isn't the core's fault).
2003-05-10 21:11:16 +00:00
cohrs
310d1d53fd B01001 - locking/unlocking a door while in a pit
Since you can't reach a door to open it while in a pit, it makes sense you
can't lock/unlock it either.
2003-03-23 20:22:00 +00:00
nethack.allison
9816ca5a5b Another switch to get_adjacent_loc() 2002-12-09 02:06:40 +00:00
cohrs
a372574583 B08018 - vision when breaking closed doors
Do vision_recalc immediately when blasting a door so that all the
subsequent messages for the same blast hitting other things are all
evaluated with the same vision in effect.
2002-08-21 04:48:17 +00:00
cohrs
194e43f882 messages when destroying a chest
Remove the special case of "the" vs "a" in chest_shatter_msg(), just
use an/An as appropriate.
2002-07-05 15:58:16 +00:00
cohrs
bf2190c55e allow locks to be forced again
- use uwep's oc_wldam value, not chest's oc_wldam value, for computing chance.
  oc_wldam has always been 0 for all containers
- the code was broken for a long time, but was masked by the off-by-1 error
  in checking the chance, allowing a 1% chance of forcing
- the result is that forcing locks is a lot easier
2002-03-05 06:21:05 +00:00