-/* NetHack 3.6 decl.h $NHDT-Date: 1496531104 2017/06/03 23:05:04 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.82 $ */
+/* NetHack 3.6 decl.h $NHDT-Date: 1547025154 2019/01/09 09:12:34 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.147 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2007. */
/* NetHack may be freely redistributed. See license for details. */
E NEARDATA struct obj *billobjs;
E NEARDATA struct obj *current_wand, *thrownobj, *kickedobj;
-E NEARDATA struct obj zeroobj; /* for init; &zeroobj used as special value */
+E NEARDATA const struct obj zeroobj; /* for init; also, &zeroobj is used
+ * as special value */
-E NEARDATA anything zeroany; /* init'd and defined in decl.c */
+E NEARDATA const anything zeroany; /* init'd and defined in decl.c */
#include "you.h"
E NEARDATA struct you u;
#include "pm.h"
#endif
-E NEARDATA struct monst zeromonst; /* for init of new or temp monsters */
+E NEARDATA const struct monst zeromonst; /* for init of new or temp monsters */
E NEARDATA struct monst youmonst; /* monster details when hero is poly'd */
E NEARDATA struct monst *mydogs, *migrating_mons;
-/* NetHack 3.6 decl.c $NHDT-Date: 1446975463 2015/11/08 09:37:43 $ $NHDT-Branch: master $:$NHDT-Revision: 1.62 $ */
+/* NetHack 3.6 decl.c $NHDT-Date: 1547025164 2019/01/09 09:12:44 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.141 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2009. */
/* NetHack may be freely redistributed. See license for details. */
NEARDATA struct obj *billobjs = (struct obj *) 0;
/* used to zero all elements of a struct obj and a struct monst */
-NEARDATA struct obj zeroobj = DUMMY;
-NEARDATA struct monst zeromonst = DUMMY;
+NEARDATA const struct obj zeroobj = DUMMY;
+NEARDATA const struct monst zeromonst = DUMMY;
/* used to zero out union any; initializer deliberately omitted */
-NEARDATA anything zeroany;
+NEARDATA const anything zeroany;
/* originally from dog.c */
NEARDATA char dogname[PL_PSIZ] = DUMMY;
-/* NetHack 3.6 invent.c $NHDT-Date: 1546770988 2019/01/06 10:36:28 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.249 $ */
+/* NetHack 3.6 invent.c $NHDT-Date: 1547025166 2019/01/09 09:12:46 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.250 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
return val2 - val1; /* bigger is better */
}
-tiebreak:
+ tiebreak:
/* They're identical, as far as we're concerned. We want
to force a deterministic order, and do so by producing a
stable sort: maintain the original order of equal items. */
&& obj->oartifact != ART_MJOLLNIR
&& (throwing_weapon(obj) || is_ammo(obj)))
setuqwep(obj);
-added:
+ added:
addinv_core2(obj);
carry_obj_effects(obj); /* carrying affects the obj */
update_inventory();
You("mime %s something%s%s.", ing_suffix(bp), suf ? " " : "",
suf ? suf : "");
}
- return (allownone ? &zeroobj : (struct obj *) 0);
+ return (allownone ? (struct obj *) &zeroobj : (struct obj *) 0);
}
-redo_menu:
+ redo_menu:
/* since gold is now kept in inventory, we need to do processing for
select-from-invent before checking whether gold has been picked */
if (ilet == '?' || ilet == '*') {
if (!ilet)
continue;
if (ilet == HANDS_SYM)
- return &zeroobj;
+ return (struct obj *) &zeroobj; /* cast away 'const' */
if (ilet == '\033') {
if (flags.verbose)
pline1(Never_mind);
* For example, if a person specifies =/ then first all rings
* will be asked about followed by all wands. -dgk
*/
-nextclass:
+ nextclass:
ilet = 'a' - 1;
if (*objchn && (*objchn)->oclass == COIN_CLASS)
ilet--; /* extra iteration */
pline("That was all.");
else if (!dud && !cnt)
pline("No applicable objects.");
-ret:
+ ret:
unsortloot(&sortedchn);
bypass_objlist(*objchn, FALSE);
return cnt;
add_menu(win, NO_GLYPH, &any, HANDS_SYM, 0, ATR_NONE,
xtra_choice, MENU_UNSELECTED);
}
-nextclass:
+ nextclass:
classcount = 0;
for (srtinv = sortedinvent; (otmp = srtinv->obj) != 0; ++srtinv) {
if (lets && !index(lets, otmp->invlet))
compatible stacks get collected along the way,
but splitting to same slot is not */
|| (splitting && let == obj->invlet)) {
- noadjust:
+ noadjust:
if (splitting)
(void) merged(&splitting, &obj);
if (!ever_mind)
-/* NetHack 3.6 muse.c $NHDT-Date: 1539804880 2018/10/17 19:34:40 $ $NHDT-Branch: keni-makedefsm $:$NHDT-Revision: 1.85 $ */
+/* NetHack 3.6 muse.c $NHDT-Date: 1547025167 2019/01/09 09:12:47 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.92 $ */
/* Copyright (C) 1990 by Ken Arromdee */
/* NetHack may be freely redistributed. See license for details. */
}
}
}
- toot:
+ toot:
;
}
m.has_defense = MUSE_SCR_CREATE_MONSTER;
}
}
-botm:
+ botm:
return (boolean) !!m.has_defense;
#undef nomore
}
mzapmsg(mtmp, otmp, TRUE);
otmp->spe--;
how = WAN_TELEPORTATION;
- mon_tele:
+ mon_tele:
if (tele_restrict(mtmp)) { /* mysterious force... */
if (vismon && how) /* mentions 'teleport' */
makeknown(how);
case MUSE_SSTAIRS:
m_flee(mtmp);
if (ledger_no(&u.uz) == 1) {
- escape:
+ escape:
/* Monsters without the Amulet escape the dungeon and
* are gone for good when they leave up the up stairs.
* A monster with the Amulet would leave it behind
if (is_animal(pm) || attacktype(pm, AT_EXPL) || mindless(mtmp->data)
|| pm->mlet == S_GHOST || pm->mlet == S_KOP)
return 0;
-try_again:
+ try_again:
switch (rn2(8 + (difficulty > 3) + (difficulty > 6) + (difficulty > 8))) {
case 6:
case 9:
(coord *) 0);
return 2;
} else {
- skipmsg:
+ skipmsg:
if (vismon) {
pline("%s looks uneasy.", Monnam(mtmp));
if (!objects[POT_GAIN_LEVEL].oc_name_known
}
}
if (t && t->ttyp == FIRE_TRAP)
- return muse_unslime(mon, &zeroobj, t, by_you);
+ return muse_unslime(mon, (struct obj *) &zeroobj, t, by_you);
} /* MUSE */
-/* NetHack 3.6 objnam.c $NHDT-Date: 1546687293 2019/01/05 11:21:33 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.232 $ */
+/* NetHack 3.6 objnam.c $NHDT-Date: 1547025168 2019/01/09 09:12:48 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.233 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2011. */
/* NetHack may be freely redistributed. See license for details. */
if (has_oname(obj) && dknown) {
Strcat(buf, " named ");
- nameit:
+ nameit:
Strcat(buf, ONAME(obj));
}
goto charges;
break;
case WAND_CLASS:
- charges:
+ charges:
if (known)
Sprintf(eos(bp), " (%d:%d)", (int) obj->recharged, obj->spe);
break;
Strcat(bp, " (lit)");
break;
case RING_CLASS:
- ring:
+ ring:
if (obj->owornmask & W_RINGR)
Strcat(bp, " (on right ");
if (obj->owornmask & W_RINGL)
return strcpy(buf, verb);
}
-sing:
+ sing:
Strcpy(buf, verb);
len = (int) strlen(buf);
bspot = buf + len - 1;
/* Default: append an 's' */
Strcasecpy(spot + 1, "s");
-bottom:
+ bottom:
if (excess)
Strcat(str, excess);
return str;
|| (p - 4 == bp && !strcmpi(p - 4, "lens"))) {
goto bottom;
}
- mins:
+ mins:
*(p - 1) = '\0'; /* drop s */
} else { /* input doesn't end in 's' */
/* here we cannot find the plural suffix */
}
-bottom:
+ bottom:
/* if we stripped off a suffix (" of bar" from "foo of bar"),
put it back now [strcat() isn't actually 100% safe here...] */
if (excess)
}
}
-retry:
+ retry:
/* "grey stone" check must be before general "stone" */
for (i = 0; i < SIZE(o_ranges); i++)
if (!strcmpi(bp, o_ranges[i].name)) {
actualn = bp;
if (!dn)
dn = actualn; /* ex. "skull cap" */
-srch:
+ srch:
/* check real names of gems first */
if (!oclass && actualn) {
for (i = bases[GEM_CLASS]; i <= LAST_GEM; i++) {
* trap objects like beartraps.
* Disallow such topology tweaks for WIZKIT startup wishes.
*/
-wiztrap:
+ wiztrap:
if (wizard && !program_state.wizkit_wishing) {
struct rm *lev;
int trap, x = u.ux, y = u.uy;
(trap != MAGIC_PORTAL) ? "" : " to nowhere");
} else
pline("Creation of %s failed.", an(tname));
- return &zeroobj;
+ return (struct obj *) &zeroobj;
}
/* furniture and terrain */
lev->blessedftn = 1;
pline("A %sfountain.", lev->blessedftn ? "magic " : "");
newsym(x, y);
- return &zeroobj;
+ return (struct obj *) &zeroobj;
}
if (!BSTRCMPI(bp, p - 6, "throne")) {
lev->typ = THRONE;
pline("A throne.");
newsym(x, y);
- return &zeroobj;
+ return (struct obj *) &zeroobj;
}
if (!BSTRCMPI(bp, p - 4, "sink")) {
lev->typ = SINK;
level.flags.nsinks++;
pline("A sink.");
newsym(x, y);
- return &zeroobj;
+ return (struct obj *) &zeroobj;
}
/* ("water" matches "potion of water" rather than terrain) */
if (!BSTRCMPI(bp, p - 4, "pool") || !BSTRCMPI(bp, p - 4, "moat")) {
/* Must manually make kelp! */
water_damage_chain(level.objects[x][y], TRUE);
newsym(x, y);
- return &zeroobj;
+ return (struct obj *) &zeroobj;
}
if (!BSTRCMPI(bp, p - 4, "lava")) { /* also matches "molten lava" */
lev->typ = LAVAPOOL;
if (!(Levitation || Flying))
(void) lava_effects();
newsym(x, y);
- return &zeroobj;
+ return (struct obj *) &zeroobj;
}
if (!BSTRCMPI(bp, p - 5, "altar")) {
lev->altarmask = Align2amask(al);
pline("%s altar.", An(align_str(al)));
newsym(x, y);
- return &zeroobj;
+ return (struct obj *) &zeroobj;
}
if (!BSTRCMPI(bp, p - 5, "grave")
pline("%s.", IS_GRAVE(lev->typ) ? "A grave"
: "Can't place a grave here");
newsym(x, y);
- return &zeroobj;
+ return (struct obj *) &zeroobj;
}
if (!BSTRCMPI(bp, p - 4, "tree")) {
pline("A tree.");
newsym(x, y);
block_point(x, y);
- return &zeroobj;
+ return (struct obj *) &zeroobj;
}
if (!BSTRCMPI(bp, p - 4, "bars")) {
lev->typ = IRONBARS;
pline("Iron bars.");
newsym(x, y);
- return &zeroobj;
+ return (struct obj *) &zeroobj;
}
}
if (!oclass)
return ((struct obj *) 0);
-any:
+ any:
if (!oclass)
- oclass = wrpsym[rn2((int) sizeof(wrpsym))];
-typfnd:
+ oclass = wrpsym[rn2((int) sizeof wrpsym)];
+ typfnd:
if (typ)
oclass = objects[typ].oc_class;
|| (otmp->oartifact && rn2(nartifact_exist()) > 1)) && !wizard) {
artifact_exists(otmp, safe_oname(otmp), FALSE);
obfree(otmp, (struct obj *) 0);
- otmp = &zeroobj;
+ otmp = (struct obj *) &zeroobj;
pline("For a moment, you feel %s in your %s, but it disappears!",
something, makeplural(body_part(HAND)));
}
-/* NetHack 3.6 weapon.c $NHDT-Date: 1545964580 2018/12/28 02:36:20 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.67 $ */
+/* NetHack 3.6 weapon.c $NHDT-Date: 1547025169 2019/01/09 09:12:49 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.68 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2011. */
/* NetHack may be freely redistributed. See license for details. */
char mlet = mtmp->data->mlet;
- propellor = &zeroobj;
+ propellor = (struct obj *) &zeroobj;
Oselect(EGG); /* cockatrice egg */
if (mlet == S_KOP) /* pies are first choice for Kops */
Oselect(CREAM_PIE);
}
/* KMH -- This belongs here so darts will work */
- propellor = &zeroobj;
+ propellor = (struct obj *) &zeroobj;
- prop = (objects[rwep[i]]).oc_skill;
+ prop = objects[rwep[i]].oc_skill;
if (prop < 0) {
switch (-prop) {
case P_BOW:
- propellor = (oselect(mtmp, YUMI));
+ propellor = oselect(mtmp, YUMI);
if (!propellor)
- propellor = (oselect(mtmp, ELVEN_BOW));
+ propellor = oselect(mtmp, ELVEN_BOW);
if (!propellor)
- propellor = (oselect(mtmp, BOW));
+ propellor = oselect(mtmp, BOW);
if (!propellor)
- propellor = (oselect(mtmp, ORCISH_BOW));
+ propellor = oselect(mtmp, ORCISH_BOW);
break;
case P_SLING:
- propellor = (oselect(mtmp, SLING));
+ propellor = oselect(mtmp, SLING);
break;
case P_CROSSBOW:
- propellor = (oselect(mtmp, CROSSBOW));
+ propellor = oselect(mtmp, CROSSBOW);
}
if ((otmp = MON_WEP(mtmp)) && mwelded(otmp) && otmp != propellor
&& mtmp->weapon_check == NO_WEAPON_WANTED)
}
if (obj && obj != &zeroobj) {
struct obj *mw_tmp = MON_WEP(mon);
+
if (mw_tmp && mw_tmp->otyp == obj->otyp) {
/* already wielding it */
mon->weapon_check = NEED_WEAPON;