Commit Graph

10402 Commits

Author SHA1 Message Date
PatR
ffcd471ef7 fix github issue #309 - random role segfault
Role selection is insanely complex.  I had to use a debugger to force
the relevant routine to be executed.

The analysis was correct:  it could use rn2(14) to pick a role (valid
values 0 through 12) and randomly getting 13 would lead to a crash.

The terminating element of roles[] passes all the ok_role(), ok_race(),
etc tests.  Explicitly exclude that element when collecting the roles
to choose from.
2020-03-01 14:36:28 -08:00
nhmall
0f3719d15e typos in doc/options.doc 2020-03-01 11:04:02 -05:00
nhmall
058fbc1cd5 more duplicate detect; also copy-and-paste for vt_tiledata entry left it enabled by default 2020-03-01 10:48:46 -05:00
PatR
99035e72ee throw-and-return vs !fixinv
Implement the request that a wielded+thrown aklys be given the same
inventory letter when it returns and is caught and rewielded, even for
the !fixinv setting where inventory letters don't stick.  Works for
Valkyrie-thrown Mjollnir and returning (ie, didn't hit) boomerangs as
well as for aklys.

I'm not sure how useful this really is, because on the rare occasions
that it either doesn't return or fails to be caught, it won't be given
the same letter when subsequently picked up.  So the player who relies
on it will still be vulnerable to using the wrong letter next time a
throw is attempted.  But at least picking it up explicitly displays
the new inventory letter, unlike catching it upon return.
2020-03-01 06:46:37 -08:00
Pasi Kallinen
297863d4bc Fix room tests 2020-03-01 10:28:19 +02:00
Pasi Kallinen
ce3b45944b Fix Fort Ludios room type
... and add an impossible when lua tries to create unknown room type.
2020-03-01 10:13:53 +02:00
PatR
95385cfc40 hard quit vs botl
For
 Really quit? [yn] y
 Dump core? [ynq] q
skip the final status update.  Noticeable when debugging and some
status breakpoints are set.
2020-02-29 16:44:48 -08:00
nhmall
16e5b27054 Merge 2020-02-29 18:49:16 -05:00
nhmall
2f1be94bfa since sole argument to set_duplicate_opt_detection was unused, eliminate it altogether 2020-02-29 18:47:34 -05:00
nhmall
c4b5d2f54b some warnings 2020-02-29 18:36:03 -05:00
nhmall
5d310d815d options follow-up: fix up duplicate_option_detection and !pet 2020-02-29 17:54:41 -05:00
nhmall
cca2bcaa84 minor flavor bit of the day 2020-02-29 13:57:31 -05:00
PatR
ae27942cd6 haste timeout, vomit countdown feedback
Change a couple of messages.  When speed/haste-self times out:
"you feel yourself slowing down" -> "you feel yourself slow down"
because the former was too close to the turn-to-stone countdown and
the loss of speed is immediate rather than gradual.

The vomiting countdown causes confusion and stun; vary the messages
for those if already confused or stunned:
"you feel slightly confused" -> "you feel slightly more confused";
"you can't seem to think straight" -> "you can't think straight".
2020-02-28 13:30:59 -08:00
Pasi Kallinen
22528d31f5 Allow coord in place of x and y in special level lua script 2020-02-28 22:14:36 +02:00
PatR
ab66475f21 X11/winstat.c formatting
Separate out the reformatting from other changes I'm working on
for X11 "fancy status".  Splits a few wide lines but mostly just
switches to the X11 idiom of combining
 XSetArg(arglist[argcount], ...);
 argcount++;
onto one line:
 XSetArg(arglist[argcount], ...); argcount++;
2020-02-27 11:51:10 -08:00
PatR
be50da07d9 botl update for trapped/untrapped
Make set_utrap() set context.botl when changing between untrapped and
trapped or vice versa.
2020-02-27 02:26:57 -08:00
nhmall
74b7ca1ad9 update a parameter in some ancient platforms 2020-02-26 21:53:07 -05:00
nhmall
3c95cba526 fix build break when there's no #define for CLIPPING 2020-02-26 21:38:38 -05:00
nhw_cron
5e3e20835b This is cron-daily v1-Jan-20-2020. files updated: Files 2020-02-26 19:48:25 -05:00
nhmall
9f01b33d9f fixes entry
This issue was present prior to the options overhaul; a fix
was embedded in the options overhaul code changes
2020-02-26 15:45:04 -05:00
nhmall
e05a6d411d Merge branch 'NetHack-3.7' of https://rodney.nethack.org:20040/git/NHsource into NetHack-3.7 2020-02-26 15:36:53 -05:00
nhmall
21ae547dec typo in fixes 2020-02-26 15:30:10 -05:00
PatR
bc0112bef7 showscore typo 2020-02-26 12:28:33 -08:00
nhmall
5f430f8105 fix warning observed on Mac OS X 2020-02-26 15:20:08 -05:00
nhmall
d609314d64 transpose error in comments bit 2020-02-26 15:03:58 -05:00
nhmall
1115402c14 Merge branch 'options-overhaul' into NetHack-3.7 2020-02-26 14:36:20 -05:00
nhmall
64e3cd72a4 fixes37.0 update for options overhaul 2020-02-26 14:32:07 -05:00
nhmall
96a559e392 fix the menu_* options which had valok set to No 2020-02-26 14:23:26 -05:00
Pasi Kallinen
d86b7e8e7c Demon lords and princes suppress teleporting in Gehennom
Instead of having the demon lair levels unconditionally no-teleport,
grant demon lords and princes the ability to suppress teleportation
in Gehennom on the level they are on.
2020-02-26 20:03:00 +02:00
Pasi Kallinen
816079c8dd Lua: accept different params for gold function 2020-02-26 17:57:47 +02:00
Pasi Kallinen
7a54edf91f Implement lua selection iteration
... and showcase it by dehardcoding the Fort Ludios treasury.
2020-02-26 17:25:28 +02:00
nhmall
68fdc3bbcb February 2020 options.c overhaul
combine boolean and compound options into a single allopt[] array for
processing in options.c.

move the definitions of the options into new include/optlist.h file which
uses a set of macros to define them appropriately.

during compile of options.c each option described in include/optlist.h:
   1. automatically results in a function prototype for an optfn called
      optfn_xxxx (xxxx is the option name).
   2. automatically results in an opt_xxxx enum value for referencing
      its index throughout options.c (xxxx is the option name).
   3. is used to initialize an element of the allopt[] array at index
      opt_xxxx (xxxx is the option name) based on the settings in the
      NHOPTB, NHOPTC, NHOPTP macros. Those macros only live during the
      compilation of include/optlist.h.

each optfn_xxxx() function can be called with a req id of: do_init, do_set,
get_val or do_handler.

req do_init is called from options_init, and if initialization or memory
allocation or other initialization for that particular option is needed,
it can be done in response to the init req.

req do_set is called from parseoptions() for each option it encounters
and the optfn_xxxx() function is expected to react and set the option
based on the string values that parseoptions() passes to it.

req get_val expects each optfn_xxxx() function to write the current
option value into the buffer it is passed.

req do_handler is called during doset() operations in response to player
selections most likely from the 'O' option-setting menu, but only if the
option is identified as having do_handler support in the allopts[]
'has_handler' boolean flag. Not every optfn_xxxx() does.

function special_handling() is eliminated. It's code has been redistributed
to individual handler functions for the option or purpose that they serve.

moved reglyph_darkroom() function from options.c to display.c
2020-02-26 00:24:37 -05:00
nhmall
1003a8142e fix a couple of warnings seen on visual studio 2019
src/sp_lev.c(4278): warning C4113: 'int (__cdecl *)()' differs in parameter lists from 'int(__cdecl *)(int,int)'
  src/sp_lev.c(5021): warning C4113: 'int (__cdecl *)()' differs in parameter lists from 'int (__cdecl *)(int,int)'
2020-02-25 22:56:50 -05:00
nhmall
a7c143c8f9 fix a pair of warnings received with visual studio
src/sp_lev.c(4278): warning C4113: 'int (__cdecl *)()' differs in parameter lists from 'int(__cdecl *)(int,int)'
src/sp_lev.c(5021): warning C4113: 'int (__cdecl *)()' differs in parameter lists from 'int (__cdecl *)(int,int)'

Add prototype prior to first reference
2020-02-25 21:37:10 -05:00
PatR
cff63b5b4c fix curses' create_nhmenu() warning
The extra flags argument to create_nhmenu() wasn't propagated to
anywhere useful.  It still doesn't do anything yet.
2020-02-25 16:18:58 -08:00
PatR
19df82971d fix nhlsel.c warning
A recent change has resulted in complaints about 'sel' not being
used in
  struct selectionvar *sel = l_selection_check(L, 1);
  struct selectionvar *ret;
  int p = (int) luaL_checkinteger(L, 2);

  lua_pop(L, 1);
  (void) l_selection_clone(L);
  ret = l_selection_check(L, 1);
  selection_filter_percent(ret, p);

This preserves the semantics of that code while getting rid of the
warning, but I have no idea whether it makes any sense.
2020-02-25 16:04:41 -08:00
Pasi Kallinen
ccb00f59bc Add new level init type, swamp
Creates a "relaxed blockwise maze".
Make Juiblex's swamp use it.
2020-02-25 19:24:58 +02:00
PatR
04d15b099b level flip comment bit 2020-02-24 17:29:32 -08:00
PatR
194b174bbc flipping current level with #wizlevelflip
Give wizard mode player control over how a level gets transposed by
prompting for the desired outcome.

Refreshing the screen showed that remembered, no longer in view wall
corners and T walls were shown with their old orientation instead of
being transposed along with the level.  This fixes that, but does so
by adding a chunk of code that will be irrelevant for normal play.
2020-02-24 17:07:01 -08:00
Pasi Kallinen
e56d3414a0 More noflip special levels 2020-02-24 19:08:58 +02:00
Pasi Kallinen
509576a8b7 Minor tweaks to level flipping 2020-02-23 15:06:44 +02:00
PatR
cbdda9dc9d adopt github pull request #286 - rndmonst()
Eliminate the cache that was supporting rndmonst() and pick a random
monster in a single pass through mons[] via "weighted reservoir
sampling", a term I'm not familiar with.

It had a couple of bugs:  if the first monster examined happened to
be given a weighting of 0, rn2() would divide by 0.  I didn't try
to figure out how to trigger that.  But the second one was easy to
trigger:  if all eligible monsters were extinct or genocided, it
would issue a warning even though the situation isn't impossible.

Aside from fixing those, the rest is mostly as-is.  I included a bit
of formatting in decl.c, moved some declarations to not require C99,
and changed a couple of macros to not hide and duplicate a call to
level_difficulty().

Fixes #286
2020-02-22 17:40:55 -08:00
PatR
5d4b9784ac more #302 - empty {bogusmon,engrave,epitaph}.txt
Have makedefs add a real data line to the output for the files that
caused trouble when empty.
2020-02-22 12:32:00 -08:00
Pasi Kallinen
dc70132da8 Change lua selection floodfill and add some tests 2020-02-22 18:35:41 +02:00
Pasi Kallinen
fe3dae85d5 Make lua selection filter_mapchar create a new selection 2020-02-22 17:51:29 +02:00
Pasi Kallinen
50eaf95c27 Make lua selection grow create a new selection 2020-02-22 16:58:45 +02:00
Pasi Kallinen
6648ecfe04 Make lua selection randline create a new selection 2020-02-22 16:34:50 +02:00
Pasi Kallinen
b3f337bdf6 Make lua selection rect and fillrect create a new selection 2020-02-22 15:23:30 +02:00
Pasi Kallinen
44f7d44e94 Make lua selection line create a new selection
... instead of modifying the one given as a parameter.

Also add some tests for it.
2020-02-22 14:23:36 +02:00
Pasi Kallinen
00a32c6039 Make lua selection percent filter create a new selection
... instead of modifying the one given as a parameter.

Also add some tests for it.
2020-02-22 13:31:47 +02:00