1
0
Fork 0
mirror of https://codeberg.org/noisytoot/notnotdnethack.git synced 2025-07-31 18:02:26 +01:00

Merge pull request #1545 from NeroOneTrueKing/patch-clang-warnings

Fix a number of Clang warnings
This commit is contained in:
Chris-plus-alphanumericgibberish 2021-05-29 23:55:10 -04:00 committed by GitHub
commit ca9728cc5b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 48 additions and 41 deletions

View file

@ -933,6 +933,7 @@ struct obj *obj;
} else if (roll_madness(MAD_ARGENT_SHEEN)) {
You("admire your reflection in the mirror.");
nomul(-1*rnd(6), "posing in front of a mirror.");
vis = FALSE;
} else if (Hallucination) {
You(look_str, hcolor((char *)0));
vis = TRUE;
@ -5625,7 +5626,7 @@ doUseComponents(optr)
struct obj **optr;
{
struct obj *obj = *optr;
struct monst *mm;
struct monst *mm = (struct monst *)0;
struct permonst *pmm;
coord cc;

View file

@ -2539,7 +2539,7 @@ char *hittee; /* target's name: "you" or mon_nam(mdef) */
if(youattack){
if(dieroll == 1){
struct obj *otmp2;
long unwornmask;
long unwornmask = 0L;
/* Don't steal worn items, and downweight wielded items */
if((otmp2 = mdef->minvent) != 0) {
@ -4304,7 +4304,7 @@ boolean * messaged;
* Not you, though. You just die. It's simpler that way. */
if (oartifact == ART_PLAGUE && artinstance[ART_PLAGUE].PlagueDoOnHit && (*hp(mdef) <= currdmg + 100) && !youdef) {
artinstance[ART_PLAGUE].PlagueDoOnHit = FALSE;
int mx, my;
int mx = x(mdef), my = y(mdef);
if (vis&VIS_MAGR && vis&VIS_MDEF) {
pline_The("tainted %s strikes true!", xname(msgr));
}
@ -4319,8 +4319,6 @@ boolean * messaged;
/* we want to avoid catching mdef in this explosion -- kludge time */
/* note: long worms still get caught in the explosion, because of course they do, so don't kludge at all to be on the safe side */
if (!is_longworm(mdef->data)) {
mx = x(mdef);
my = y(mdef);
level.monsters[mx][my] = (struct monst *)0;
}
@ -7563,7 +7561,7 @@ arti_invoke(obj)
} break;
case ARTIFICE:{
int artificeFunc = doartificemenu("Improve weapon or armor:", obj);
struct obj *scroll;
struct obj *scroll = (struct obj *)0;
switch(artificeFunc){
case 0:
break;
@ -7574,11 +7572,13 @@ arti_invoke(obj)
scroll = mksobj(SCR_ENCHANT_ARMOR, NO_MKOBJ_FLAGS);
break;
}
scroll->blessed = obj->blessed;
scroll->cursed = obj->cursed;
scroll->quan = 20; /* do not let useup get it */
seffects(scroll);
obfree(scroll,(struct obj *)0); /* now, get rid of it */
if (scroll) {
scroll->blessed = obj->blessed;
scroll->cursed = obj->cursed;
scroll->quan = 20; /* do not let useup get it */
seffects(scroll);
obfree(scroll,(struct obj *)0); /* now, get rid of it */
}
} break;
case SUMMON_PET:{
/* TODO */

View file

@ -3743,7 +3743,7 @@ long* out_cnt;
struct obj **oarray;
int i, j;
#endif
char ilet, ret;
char ilet, ret = '\0';
char *invlet = flags.inv_order;
int n, classcount;
winid win; /* windows being used */
@ -3808,7 +3808,6 @@ long* out_cnt;
/* when only one item of interest, use pline instead of menus;
we actually use a fake message-line menu in order to allow
the user to perform selection at the --More-- prompt for tty */
ret = '\0';
for (otmp = invent; otmp; otmp = otmp->nobj) {
if (otmp->invlet == lets[0]) {
#ifdef DUMP_LOG

View file

@ -3281,19 +3281,21 @@ dealloc_obj(obj)
struct obj *obj;
{
if (obj->where != OBJ_FREE)
panic("dealloc_obj: obj not free");
panic("dealloc_obj: obj not free");
/* free up any timers attached to the object */
if (obj->timed)
stop_all_timers(obj->timed);
stop_all_timers(obj->timed);
/*
* Free up any light sources attached to the object.
*/
if (obj->light)
del_light_source(obj->light);
del_light_source(obj->light);
//if (obj == thrownobj) thrownobj = (struct obj*)0;
/* Free any oextra attached to the object */
if (obj->oextra_p)
rem_all_ox(obj);
free((genericptr_t) obj);
}

View file

@ -4631,6 +4631,10 @@ struct monst *mon;
else return;
if (rn2(3)) return;
}
else {
impossible("Unhandled spore type in spore_dies, %d", mon->mtyp);
sporetype = 0;
}
/* when creating a new fern, 5/6 chance of creating
a fern sprout and 1/6 chance of a fully-grown one */
switch (sporetype) {

View file

@ -2955,10 +2955,10 @@ int ga_num;
gnam = Silence;
break;
case GA_CHAOS_FF:
if(In_FF_quest(&u.uz)){
if(on_level(&chaose_level,&u.uz)) gnam = DeepChaos;
else gnam = Chaos;
}
if(In_FF_quest(&u.uz) && on_level(&chaose_level,&u.uz))
gnam = DeepChaos;
else
gnam = Chaos;
break;
case GA_DEMIURGE:
gnam = Demiurge;

View file

@ -273,13 +273,13 @@ register struct monst *mon;
/* by this point you have discovered mon's identity, blind or not... */
if (helpless || rn2(120) > ACURR(A_CHA) + ACURR(A_WIS)) {
struct trap *ttmp2 = maketrap(u.ux, u.uy, WEB);
struct trap *ttmp2;
/* Don't bother with mspec_used here... it didn't get tired! */
LolthAttacks:
if (Blind) You("suddenly find yourself in the arms of a giant spider!");
else pline("She suddenly becomes a giant spider and seizes you with her legs!");
//Lolth bad
if (ttmp2) {
if ((ttmp2 = maketrap(u.ux, u.uy, WEB))) {
pline("She wraps you tight in her webs!");
dotrap(ttmp2, NOWEBMSG);
#ifdef STEED

View file

@ -5537,6 +5537,9 @@ shk_charge(slang, shkp)
} else if (ESHK(shkp)->services & SHK_SPECIAL_B) {
pline ("I only perform complete charging.");
type = 'p';
} else { /* currently impossible case */
pline ("Sorry about that, it seems I can't do any charging.");
return;
}
}
else

View file

@ -557,7 +557,7 @@ clonewiz()
int
pick_nasty()
{
int tries;
int tries = 0;
int mndx;
do{
mndx = nasties[rn2(SIZE(nasties))];

View file

@ -6853,8 +6853,6 @@ boolean ranged;
/* make a special x_monnam() call that never omits
the saddle, and save it for later messages */
Strcpy(mdefnambuf, x_monnam(mdef, ARTICLE_THE, (char *)0, 0, FALSE));
otmp = otmp;
#ifdef STEED
if (u.usteed == mdef &&
otmp == which_armor(mdef, W_SADDLE))
@ -8162,7 +8160,7 @@ boolean ranged;
/* 1/10 chance of stealing items */
if (!rn2(10)){
struct obj *otmp2, **minvent_ptr;
long unwornmask;
long unwornmask = 0L;
/* Don't steal worn items, and downweight wielded items */
if ((otmp2 = mdef->minvent) != 0) {
@ -15285,7 +15283,7 @@ boolean endofchain; /* if the passive is occuring at the end of aggressor's at
int newres;
int dmg;
long slot = 0L;
struct monst * mtmp;
struct monst * mtmp = (struct monst *)0;
boolean youagr = (magr == &youmonst);
boolean youdef = (mdef == &youmonst);
/* set permonst pointers */
@ -15766,7 +15764,6 @@ boolean endofchain; /* if the passive is occuring at the end of aggressor's at
}
/* anger autons */
if (youagr) {
struct monst * mtmp;
int mndx;
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
mndx = monsndx(mtmp->data);

View file

@ -1731,46 +1731,47 @@ poly_obj(obj, id)
case TOOL_CLASS:
if (otmp->otyp == CANDLE_OF_INVOCATION) {
otmp->otyp = WAX_CANDLE;
otmp->age = 400L;
otmp->otyp = WAX_CANDLE;
otmp->age = 400L;
}
else if (otmp->otyp == MAGIC_LAMP) {
otmp->otyp = OIL_LAMP;
otmp->age = 1500L; /* "best" oil lamp possible */
otmp->otyp = OIL_LAMP;
otmp->age = 1500L; /* "best" oil lamp possible */
} else if (otmp->otyp == MAGIC_MARKER) {
otmp->recharged = 1; /* degraded quality */
otmp->recharged = 1; /* degraded quality */
}
/* don't care about the recharge count of other tools */
break;
case WAND_CLASS:
while (otmp->otyp == WAN_WISHING || otmp->otyp == WAN_POLYMORPH)
otmp->otyp = rnd_class(WAN_LIGHT, WAN_LIGHTNING);
otmp->otyp = rnd_class(WAN_LIGHT, WAN_LIGHTNING);
/* altering the object tends to degrade its quality
(analogous to spellbook `read count' handling) */
if ((int)otmp->recharged < rn2(7)) /* recharge_limit */
otmp->recharged++;
otmp->recharged++;
break;
case POTION_CLASS:
while (otmp->otyp == POT_POLYMORPH)
otmp->otyp = rnd_class(POT_GAIN_ABILITY, POT_WATER);
otmp->otyp = rnd_class(POT_GAIN_ABILITY, POT_WATER);
break;
case SPBOOK_CLASS:
while (otmp->otyp == SPE_POLYMORPH)
otmp->otyp = rnd_class(SPE_DIG, SPE_BLANK_PAPER);
otmp->otyp = rnd_class(SPE_DIG, SPE_BLANK_PAPER);
/* reduce spellbook abuse */
if(otmp->spestudied > MAX_SPELL_STUDY){
otmp->otyp = SPE_BLANK_PAPER;
otmp->obj_color = objects[SPE_BLANK_PAPER].oc_color;
}
else otmp->spestudied = obj->spestudied + 1;
else
otmp->spestudied = obj->spestudied + 1;
break;
case RING_CLASS:
while (otmp->otyp == RIN_WISHES)
otmp->otyp = rnd_class(RIN_WISHES, RIN_PROTECTION_FROM_SHAPE_CHAN);
otmp->otyp = rnd_class(RIN_WISHES, RIN_PROTECTION_FROM_SHAPE_CHAN);
break;
case GEM_CLASS:
@ -3830,7 +3831,7 @@ struct zapdata * zapdata; /* lots of flags and data about the zap */
/* disintegrate terrain */
/* maybe move this to dig.c? it's very very similar to zap_dig. */
if (zapdata->adtyp == AD_DISN) {
boolean shopdoor, shopwall;
boolean shopdoor = FALSE, shopwall = FALSE;
if (!isok(sx, sy)) {
if (isok(sx-dx, sy-dy) && cansee(sx-dx, sy-dy))
pline("The wall glows then fades.");