Merge branch 'NetHack-3.6.0' of https://rodney.nethack.org:20040/git/NHsource into NetHack-3.6.0

This commit is contained in:
Alex Smith
2017-09-01 17:44:31 +01:00
63 changed files with 1899 additions and 4611 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 bones.c $NHDT-Date: 1450432756 2015/12/18 09:59:16 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.68 $ */
/* NetHack 3.6 bones.c $NHDT-Date: 1503309019 2017/08/21 09:50:19 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.70 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985,1993. */
/* NetHack may be freely redistributed. See license for details. */
@@ -549,7 +549,7 @@ getbones()
{
register int fd;
register int ok;
char c, *bonesid, oldbonesid[10];
char c, *bonesid, oldbonesid[40]; /* was [10]; more should be safer */
if (discover) /* save bones files for real games */
return 0;
@@ -581,7 +581,15 @@ getbones()
}
mread(fd, (genericptr_t) &c, sizeof c); /* length incl. '\0' */
mread(fd, (genericptr_t) oldbonesid, (unsigned) c); /* DD.nnn */
if (strcmp(bonesid, oldbonesid) != 0) {
if (strcmp(bonesid, oldbonesid) != 0
/* from 3.3.0 through 3.6.0, bones in the quest branch stored
a bogus bonesid in the file; 3.6.1 fixed that, but for
3.6.0 bones to remain compatible, we need an extra test;
once compatibility with 3.6.x goes away, this can too
(we don't try to make this conditional upon the value of
VERSION_COMPATIBILITY because then we'd need patchlevel.h) */
&& (strlen(bonesid) <= 2
|| strcmp(bonesid + 2, oldbonesid) != 0)) {
char errbuf[BUFSZ];
Sprintf(errbuf, "This is bones level '%s', not '%s'!", oldbonesid,

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 dbridge.c $NHDT-Date: 1449269914 2015/12/04 22:58:34 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.35 $ */
/* NetHack 3.6 dbridge.c $NHDT-Date: 1503355815 2017/08/21 22:50:15 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.39 $ */
/* Copyright (c) 1989 by Jean-Christophe Collet */
/* NetHack may be freely redistributed. See license for details. */
@@ -230,7 +230,6 @@ int *x, *y;
* dir is the direction.
* flag must be put to TRUE if we want the drawbridge to be opened.
*/
boolean
create_drawbridge(x, y, dir, flag)
int x, y, dir;
@@ -375,7 +374,6 @@ struct entity *etmp;
* Generates capitalized entity name, makes 2nd -> 3rd person conversion on
* verb, where necessary.
*/
STATIC_OVL const char *
E_phrase(etmp, verb)
struct entity *etmp;
@@ -397,7 +395,6 @@ const char *verb;
/*
* Simple-minded "can it be here?" routine
*/
STATIC_OVL boolean
e_survives_at(etmp, x, y)
struct entity *etmp;
@@ -486,7 +483,6 @@ int xkill_flags, how;
/*
* These are never directly affected by a bridge or portcullis.
*/
STATIC_OVL boolean
automiss(etmp)
struct entity *etmp;
@@ -498,7 +494,6 @@ struct entity *etmp;
/*
* Does falling drawbridge or portcullis miss etmp?
*/
STATIC_OVL boolean
e_missed(etmp, chunks)
struct entity *etmp;
@@ -536,7 +531,6 @@ boolean chunks;
/*
* Can etmp jump from death?
*/
STATIC_OVL boolean
e_jumps(etmp)
struct entity *etmp;
@@ -604,6 +598,11 @@ struct entity *etmp;
}
} else {
if (crm->typ == DRAWBRIDGE_DOWN) {
if (is_u(etmp)) {
killer.format = NO_KILLER_PREFIX;
Strcpy(killer.name,
"crushed to death underneath a drawbridge");
}
pline("%s crushed underneath the drawbridge.",
E_phrase(etmp, "are")); /* no jump */
e_died(etmp,
@@ -639,11 +638,10 @@ struct entity *etmp;
/*
* Here's where we try to do relocation. Assumes that etmp is not
* arriving
* at the portcullis square while the drawbridge is falling, since this
* square
* would be inaccessible (i.e. etmp started on drawbridge square) or
* unnecessary (i.e. etmp started here) in such a situation.
* arriving at the portcullis square while the drawbridge is
* falling, since this square would be inaccessible (i.e. etmp
* started on drawbridge square) or unnecessary (i.e. etmp started
* here) in such a situation.
*/
debugpline0("Doing relocation.");
newx = oldx;
@@ -654,12 +652,10 @@ struct entity *etmp;
debugpline0("Checking new square for occupancy.");
if (relocates && (e_at(newx, newy))) {
/*
* Standoff problem: one or both entities must die, and/or both
* switch
* places. Avoid infinite recursion by checking first whether the
* other
* entity is staying put. Clean up if we happen to move/die in
* recursion.
* Standoff problem: one or both entities must die, and/or
* both switch places. Avoid infinite recursion by checking
* first whether the other entity is staying put. Clean up if
* we happen to move/die in recursion.
*/
struct entity *other;
@@ -763,10 +759,12 @@ struct entity *etmp;
}
}
/* clear stale reason for death before returning */
#define nokiller() (killer.name[0] = '\0', killer.format = 0)
/*
* Close the drawbridge located at x,y
*/
void
close_drawbridge(x, y)
int x, y;
@@ -823,12 +821,12 @@ int x, y;
newsym(x, y);
newsym(x2, y2);
block_point(x2, y2); /* vision */
nokiller();
}
/*
* Open the drawbridge located at x,y
*/
void
open_drawbridge(x, y)
int x, y;
@@ -870,12 +868,12 @@ int x, y;
unblock_point(x2, y2); /* vision */
if (Is_stronghold(&u.uz))
u.uevent.uopened_dbridge = TRUE;
nokiller();
}
/*
* Let's destroy the drawbridge located at x,y
*/
void
destroy_drawbridge(x, y)
int x, y;
@@ -898,6 +896,7 @@ int x, y;
|| (lev1->drawbridgemask & DB_UNDER) == DB_LAVA) {
struct obj *otmp2;
boolean lava = (lev1->drawbridgemask & DB_UNDER) == DB_LAVA;
if (lev1->typ == DRAWBRIDGE_UP) {
if (cansee(x2, y2))
pline_The("portcullis of the drawbridge falls into the %s!",
@@ -999,6 +998,7 @@ int x, y;
do_entity(etmp1);
}
}
nokiller();
}
/*dbridge.c*/

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 explode.c $NHDT-Date: 1496103440 2017/05/30 00:17:20 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.49 $ */
/* NetHack 3.6 explode.c $NHDT-Date: 1503355817 2017/08/21 22:50:17 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.50 $ */
/* Copyright (C) 1990 by Ken Arromdee */
/* NetHack may be freely redistributed. See license for details. */
@@ -90,7 +90,9 @@ int expltype;
if (olet == MON_EXPLODE) {
str = killer.name;
do_hallu = Hallucination && strstri(str, "'s explosion");
do_hallu = (Hallucination
&& (strstri(str, "'s explosion")
|| strstri(str, "s' explosion")));
adtyp = AD_PHYS;
} else
switch (abs(type) % 10) {

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 files.c $NHDT-Date: 1502581476 2017/08/12 23:44:36 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.211 $ */
/* NetHack 3.6 files.c $NHDT-Date: 1503309020 2017/08/21 09:50:20 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.215 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -697,17 +697,47 @@ d_level *lev;
s_level *sptr;
char *dptr;
Sprintf(file, "bon%c%s", dungeons[lev->dnum].boneid,
/*
* "bonD0.nn" = bones for level nn in the main dungeon;
* "bonM0.T" = bones for Minetown;
* "bonQBar.n" = bones for level n in the Barbarian quest;
* "bon3D0.nn" = \
* "bon3M0.T" = > same as above, but for bones pool #3.
* "bon3QBar.n" = /
*
* Return value for content validation skips "bon" and the
* pool number (if present), making it feasible for the admin
* to manually move a bones file from one pool to another by
* renaming it.
*/
Strcpy(file, "bon");
#ifdef SYSCF
if (sysopt.bones_pools > 1) {
unsigned poolnum = min((unsigned) sysopt.bones_pools, 10);
poolnum = (unsigned) ubirthday % poolnum; /* 0..9 */
Sprintf(eos(file), "%u", poolnum);
}
#endif
dptr = eos(file); /* this used to be after the following Sprintf()
and the return value was (dptr - 2) */
/* when this naming scheme was adopted, 'filecode' was one letter;
3.3.0 turned it into a three letter string (via roles[] in role.c);
from that version through 3.6.0, 'dptr' pointed past the filecode
and the return value of (dptr - 2) was wrong for bones produced
in the quest branch, skipping the boneid character 'Q' and the
first letter of the role's filecode; bones loading still worked
because the bonesid used for validation had the same error */
Sprintf(dptr, "%c%s", dungeons[lev->dnum].boneid,
In_quest(lev) ? urole.filecode : "0");
dptr = eos(file);
if ((sptr = Is_special(lev)) != 0)
Sprintf(dptr, ".%c", sptr->boneid);
Sprintf(eos(dptr), ".%c", sptr->boneid);
else
Sprintf(dptr, ".%d", lev->dlevel);
Sprintf(eos(dptr), ".%d", lev->dlevel);
#ifdef VMS
Strcat(dptr, ";1");
#endif
return (dptr - 2);
return dptr;
}
/* set up temporary file name for writing bones, to avoid another game's
@@ -2279,6 +2309,14 @@ int src;
if (sysopt.genericusers)
free((genericptr_t) sysopt.genericusers);
sysopt.genericusers = dupstr(bufp);
} else if (src == SET_IN_SYS && match_varname(buf, "BONES_POOLS", 10)) {
/* max value of 10 guarantees (N % bones.pools) will be one digit
so we don't lose control of the length of bones file names */
n = atoi(bufp);
sysopt.bones_pools = (n <= 0) ? 0 : min(n, 10);
/* note: right now bones_pools==0 is the same as bones_pools==1,
but we could change that and make bones_pools==0 become an
indicator to suppress bones usage altogether */
} else if (src == SET_IN_SYS && match_varname(buf, "SUPPORT", 7)) {
if (sysopt.support)
free((genericptr_t) sysopt.support);

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 mon.c $NHDT-Date: 1502753408 2017/08/14 23:30:08 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.242 $ */
/* NetHack 3.6 mon.c $NHDT-Date: 1503355818 2017/08/21 22:50:18 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.243 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1994,6 +1994,8 @@ boolean was_swallowed; /* digestion */
Sprintf(killer.name, "%s explosion", s_suffix(mdat->mname));
killer.format = KILLED_BY_AN;
explode(mon->mx, mon->my, -1, tmp, MON_EXPLODE, EXPL_NOXIOUS);
killer.name[0] = '\0';
killer.format = 0;
return FALSE;
}
}

View File

@@ -485,7 +485,7 @@ static const menu_cmd_t default_menu_cmd_info[] = {
{ "menu_previous_page", MENU_PREVIOUS_PAGE, "Go to previous page" },
{ "menu_select_all", MENU_SELECT_ALL, "Select all items" },
{ "menu_deselect_all", MENU_UNSELECT_ALL, "Unselect all items" },
{ "menu_invert_all", MENU_INVERT_ALL, "Insert selection" },
{ "menu_invert_all", MENU_INVERT_ALL, "Invert selection" },
{ "menu_select_page", MENU_SELECT_PAGE, "Select items in current page" },
{ "menu_deselect_page", MENU_UNSELECT_PAGE, "Unselect items in current page" },
{ "menu_invert_page", MENU_INVERT_PAGE, "Invert current page selection" },

View File

@@ -707,7 +707,7 @@ int what; /* should be a long */
/* position may need updating (invisible hero) */
if (n_picked)
newsym(u.ux, u.uy);
newsym_force(u.ux, u.uy);
/* check if there's anything else here after auto-pickup is done */
if (autopickup)

View File

@@ -930,7 +930,7 @@ is_valid_stinking_cloud_pos(x, y, showmsg)
int x, y;
boolean showmsg;
{
if (get_valid_stinking_cloud_pos(x,y)) {
if (!get_valid_stinking_cloud_pos(x,y)) {
if (showmsg)
You("smell rotten eggs.");
return FALSE;
@@ -1556,8 +1556,14 @@ struct obj *sobj; /* scroll, or fake spellbook object for scroll-like spell */
pline("Thinking of Maud you forget everything else.");
exercise(A_WIS, FALSE);
break;
case SCR_FIRE:
case SCR_FIRE: {
coord cc;
int dam;
cc.x = u.ux;
cc.y = u.uy;
cval = bcsign(sobj);
dam = (2 * (rn1(3, 3) + 2 * cval) + 1) / 3;
useup(sobj);
sobj = 0; /* it's gone */
if (!already_known)
@@ -1581,13 +1587,28 @@ struct obj *sobj; /* scroll, or fake spellbook object for scroll-like spell */
if (Underwater) {
pline_The("%s around you vaporizes violently!", hliquid("water"));
} else {
pline_The("scroll erupts in a tower of flame!");
iflags.last_msg = PLNMSG_TOWER_OF_FLAME; /* for explode() */
burn_away_slime();
if (sblessed) {
if (!already_known)
pline("This is a scroll of fire!");
dam *= 5;
pline("Where do you want to center the explosion?");
getpos_sethilite(display_stinking_cloud_positions, get_valid_stinking_cloud_pos);
(void) getpos(&cc, TRUE, "the desired position");
if (!is_valid_stinking_cloud_pos(cc.x, cc.y, FALSE)) {
/* try to reach too far, get burned */
cc.x = u.ux;
cc.y = u.uy;
}
}
if (cc.x == u.ux && cc.y == u.uy) {
pline_The("scroll erupts in a tower of flame!");
iflags.last_msg = PLNMSG_TOWER_OF_FLAME; /* for explode() */
burn_away_slime();
}
}
explode(u.ux, u.uy, 11, (2 * (rn1(3, 3) + 2 * cval) + 1) / 3,
SCROLL_CLASS, EXPL_FIERY);
explode(cc.x, cc.y, 11, dam, SCROLL_CLASS, EXPL_FIERY);
break;
}
case SCR_EARTH:
/* TODO: handle steeds */
if (!Is_rogue_level(&u.uz) && has_ceiling(&u.uz)

View File

@@ -40,6 +40,7 @@ sys_early_init()
sysopt.explorers = (char *) 0;
sysopt.genericusers = (char *) 0;
sysopt.maxplayers = 0; /* XXX eventually replace MAX_NR_OF_PLAYERS */
sysopt.bones_pools = 0;
/* record file */
sysopt.persmax = PERSMAX;

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 u_init.c $NHDT-Date: 1454660565 2016/02/05 08:22:45 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.37 $ */
/* NetHack 3.6 u_init.c $NHDT-Date: 1503960969 2017/08/28 22:56:09 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.40 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -124,7 +124,7 @@ static struct trobj Rogue[] = {
{ DAGGER, 0, WEAPON_CLASS, 10, 0 }, /* quan is variable */
{ LEATHER_ARMOR, 1, ARMOR_CLASS, 1, UNDEF_BLESS },
{ POT_SICKNESS, 0, POTION_CLASS, 1, 0 },
{ LOCK_PICK, 9, TOOL_CLASS, 1, 0 },
{ LOCK_PICK, 0, TOOL_CLASS, 1, 0 },
{ SACK, 0, TOOL_CLASS, 1, 0 },
{ 0, 0, 0, 0, 0 }
};