replace 3 files and add 1 prototype

Changes to be committed:
	modified:   include/extern.h
	modified:   src/apply.c
	modified:   src/sys.c
	modified:   win/tty/wintty.c

The 3 files appeared to be missing sections. The erronoeous
versions have been emailed to the win32 team to determine
their fate.

Adds a missing prototype also.
This commit is contained in:
nhmall
2015-04-06 10:41:10 -04:00
parent b4142b5894
commit 4494b328f0
4 changed files with 10 additions and 262 deletions

View File

@@ -742,6 +742,7 @@ E boolean NDECL(recover_savefile);
#ifdef SYSCF_FILE
E void NDECL(assure_syscf_file);
#endif
E int FDECL(nhclose, (int));
#ifdef HOLD_LOCKFILE_OPEN
E void NDECL(really_close);
#endif

View File

@@ -1,4 +1,5 @@
/* NetHack 3.5 apply.c $NHDT-Date: 1426465431 2015/03/16 00:23:51 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.173 $ */
/* NetHack 3.5 apply.c $Date: 2012/05/01 02:22:32 $ $Revision: 1.168 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1796,268 +1797,6 @@ struct obj *obj;
#undef TimedTrouble
}
/*
* Timer callback routine: turn figurine into monster
*/
void
fig_transform(arg, timeout)
anything *arg;
long timeout;
{
struct obj *figurine = arg->a_obj;
struct monst *mtmp;
coord cc;
boolean cansee_spot, silent, okay_spot;
boolean redraw = FALSE;
boolean suppress_see = FALSE;
char monnambuf[BUFSZ], carriedby[BUFSZ];
if (!figurine) {
nomovemsg = "";
morehungry(rnd(25));
return 1;
}
}
boolean
tinnable(corpse)
struct obj *corpse;
{
if (corpse->oeaten) return 0;
if (!mons[corpse->corpsenm].cnutrit) return 0;
return 1;
}
STATIC_OVL void
use_tinning_kit(obj)
register struct obj *obj;
{
register struct obj *corpse, *can;
/* This takes only 1 move. If this is to be changed to take many
* moves, we've got to deal with decaying corpses...
*/
if (obj->spe <= 0) {
You("seem to be out of tins.");
return;
}
if (!(corpse = floorfood("tin", 2))) return;
if (corpse->oeaten) {
You("cannot tin %s which is partly eaten.",something);
return;
}
if (touch_petrifies(&mons[corpse->corpsenm])
&& !Stone_resistance && !uarmg) {
char kbuf[BUFSZ];
if (poly_when_stoned(youmonst.data))
You("tin %s without wearing gloves.",
an(mons[corpse->corpsenm].mname));
else {
pline("Tinning %s without wearing gloves is a fatal mistake...",
an(mons[corpse->corpsenm].mname));
Sprintf(kbuf, "trying to tin %s without gloves",
an(mons[corpse->corpsenm].mname));
}
instapetrify(kbuf);
}
if (is_rider(&mons[corpse->corpsenm])) {
if (revive_corpse(corpse))
verbalize("Yes... But War does not preserve its enemies...");
else
pline_The("corpse evades your grasp.");
return;
}
if (mons[corpse->corpsenm].cnutrit == 0) {
pline("That's too insubstantial to tin.");
return;
}
consume_obj_charge(obj, TRUE);
if ((can = mksobj(TIN, FALSE, FALSE)) != 0) {
static const char you_buy_it[] = "You tin it, you bought it!";
can->corpsenm = corpse->corpsenm;
can->cursed = obj->cursed;
can->blessed = obj->blessed;
can->owt = weight(can);
can->known = 1;
/* Mark tinned tins. No spinach allowed... */
set_tin_variety(can, HOMEMADE_TIN);
if (carried(corpse)) {
if (corpse->unpaid)
verbalize(you_buy_it);
useup(corpse);
} else {
if (costly_spot(corpse->ox, corpse->oy) && !corpse->no_charge)
verbalize(you_buy_it);
useupf(corpse, 1L);
}
can = hold_another_object(can, "You make, but cannot pick up, %s.",
doname(can), (const char *)0);
} else impossible("Tinning failed.");
}
void
use_unicorn_horn(obj)
struct obj *obj;
{
#define PROP_COUNT 6 /* number of properties we're dealing with */
#define ATTR_COUNT (A_MAX*3) /* number of attribute points we might fix */
int idx, val, val_limit,
trouble_count, unfixable_trbl, did_prop, did_attr;
int trouble_list[PROP_COUNT + ATTR_COUNT];
if (obj && obj->cursed) {
long lcount = (long) rnd(100);
switch (rn2(6)) {
case 0: make_sick((Sick & TIMEOUT) ? (Sick & TIMEOUT) / 3L + 1L :
(long)rn1(ACURR(A_CON),20),
xname(obj), TRUE, SICK_NONVOMITABLE);
break;
case 1: make_blinded((Blinded & TIMEOUT) + lcount, TRUE);
break;
case 2: if (!Confusion)
You("suddenly feel %s.",
Hallucination ? "trippy" : "confused");
make_confused((HConfusion & TIMEOUT) + lcount, TRUE);
break;
case 3: make_stunned((HStun & TIMEOUT) + lcount, TRUE);
break;
case 4: (void) adjattrib(rn2(A_MAX), -1, FALSE);
break;
case 5: (void) make_hallucinated((HHallucination & TIMEOUT)
+ lcount, TRUE, 0L);
break;
}
return;
}
/*
* Entries in the trouble list use a very simple encoding scheme.
*/
#define prop2trbl(X) ((X) + A_MAX)
#define attr2trbl(Y) (Y)
#define prop_trouble(X) trouble_list[trouble_count++] = prop2trbl(X)
#define attr_trouble(Y) trouble_list[trouble_count++] = attr2trbl(Y)
#define TimedTrouble(P) (((P) && !((P) & ~TIMEOUT)) ? ((P) & TIMEOUT) : 0L)
trouble_count = unfixable_trbl = did_prop = did_attr = 0;
/* collect property troubles */
if (TimedTrouble(Sick)) prop_trouble(SICK);
if (TimedTrouble(Blinded) > (long)u.ucreamed &&
!(u.uswallow &&
attacktype_fordmg(u.ustuck->data, AT_ENGL, AD_BLND)))
prop_trouble(BLINDED);
if (TimedTrouble(HHallucination)) prop_trouble(HALLUC);
if (TimedTrouble(Vomiting)) prop_trouble(VOMITING);
if (TimedTrouble(HConfusion)) prop_trouble(CONFUSION);
if (TimedTrouble(HStun)) prop_trouble(STUNNED);
unfixable_trbl = unfixable_trouble_count(TRUE);
/* collect attribute troubles */
for (idx = 0; idx < A_MAX; idx++) {
if (ABASE(idx) >= AMAX(idx)) continue;
val_limit = AMAX(idx);
/* don't recover strength lost from hunger */
if (idx == A_STR && u.uhs >= WEAK) val_limit--;
if (Fixed_abil) {
/* potion/spell of restore ability override sustain ability
intrinsic but unicorn horn usage doesn't */
unfixable_trbl += val_limit - ABASE(idx);
continue;
}
/* don't recover more than 3 points worth of any attribute */
if (val_limit > ABASE(idx) + 3) val_limit = ABASE(idx) + 3;
for (val = ABASE(idx); val < val_limit; val++)
attr_trouble(idx);
/* keep track of unfixed trouble, for message adjustment below */
unfixable_trbl += (AMAX(idx) - val_limit);
}
if (trouble_count == 0) {
pline1(nothing_happens);
return;
} else if (trouble_count > 1) { /* shuffle */
int i, j, k;
for (i = trouble_count - 1; i > 0; i--)
if ((j = rn2(i + 1)) != i) {
k = trouble_list[j];
trouble_list[j] = trouble_list[i];
trouble_list[i] = k;
}
}
/*
* Chances for number of troubles to be fixed
* 0 1 2 3 4 5 6 7
* blessed: 22.7% 22.7% 19.5% 15.4% 10.7% 5.7% 2.6% 0.8%
* uncursed: 35.4% 35.4% 22.9% 6.3% 0 0 0 0
*/
val_limit = rn2( d(2, (obj && obj->blessed) ? 4 : 2) );
if (val_limit > trouble_count) val_limit = trouble_count;
/* fix [some of] the troubles */
for (val = 0; val < val_limit; val++) {
idx = trouble_list[val];
switch (idx) {
case prop2trbl(SICK):
make_sick(0L, (char *) 0, TRUE, SICK_ALL);
did_prop++;
break;
case prop2trbl(BLINDED):
make_blinded((long)u.ucreamed, TRUE);
did_prop++;
break;
case prop2trbl(HALLUC):
(void) make_hallucinated(0L, TRUE, 0L);
did_prop++;
break;
case prop2trbl(VOMITING):
make_vomiting(0L, TRUE);
did_prop++;
break;
case prop2trbl(CONFUSION):
make_confused(0L, TRUE);
did_prop++;
break;
case prop2trbl(STUNNED):
make_stunned(0L, TRUE);
did_prop++;
break;
default:
if (idx >= 0 && idx < A_MAX) {
ABASE(idx) += 1;
did_attr++;
} else
panic("use_unicorn_horn: bad trouble? (%d)", idx);
break;
}
}
if (did_attr)
pline("This makes you feel %s!",
(did_prop + did_attr) == (trouble_count + unfixable_trbl) ?
"great" : "better");
else if (!did_prop)
pline("Nothing seems to happen.");
context.botl = (did_attr || did_prop);
#undef PROP_COUNT
#undef ATTR_COUNT
#undef prop2trbl
#undef attr2trbl
#undef prop_trouble
#undef attr_trouble
#undef TimedTrouble
}
/*
* Timer callback routine: turn figurine into monster
*/

View File

@@ -1,4 +1,5 @@
/* NetHack 3.5 sys.c $NHDT-Date: 1426544797 2015/03/16 22:26:37 $ $NHDT-Branch: master $:$NHDT-Revision: 1.18 $ */
/* NetHack 3.5 sys.c $Date: 2012/03/10 02:22:07 $ $Revision: 1.12 $ */
/* Copyright (c) Kenneth Lorber, Kensington, Maryland, 2008. */
/* NetHack may be freely redistributed. See license for details. */
@@ -11,6 +12,7 @@
/* # define DEBUGFILES "*" */
/* note: DEBUGFILES value here or in sysconf.DEBUGFILES can be overridden
at runtime by setting up a value for "DEBUGFILES" in the environment */
#endif
struct sysopt sysopt;

View File

@@ -1,4 +1,5 @@
/* NetHack 3.5 wintty.c $NHDT-Date: 1427667623 2015/03/29 22:20:23 $ $NHDT-Branch: master $:$NHDT-Revision: 1.75 $ */
/* NetHack 3.5 wintty.c $Date: 2012/01/22 06:27:09 $ $Revision: 1.66 $ */
/* Copyright (c) David Cohrs, 1991 */
/* NetHack may be freely redistributed. See license for details. */
@@ -2204,6 +2205,11 @@ tty_putstr(window, attr, str)
tty_putstr(window, attr, &str[i]);
}
}
break;
}
}
void
tty_display_file(fname, complain)
const char *fname;