From: PatR Date: Sun, 15 May 2016 01:26:48 +0000 (-0700) Subject: misc core formatting X-Git-Tag: NetHack-3.6.1_RC01~769 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=26226a1cdbfe6a33e84f2195c22ec8de37b27247;p=nethack misc core formatting Some of these are post-3.6.0, some just got overlooked before the 3.6.0 release. --- diff --git a/src/end.c b/src/end.c index f41890dc6..437b9072d 100644 --- a/src/end.c +++ b/src/end.c @@ -952,8 +952,8 @@ int how; return; } } - if ((wizard || discover) && (how <= GENOCIDED) && - !paranoid_query(ParanoidDie, "Die?")) { + if ((wizard || discover) && (how <= GENOCIDED) + && !paranoid_query(ParanoidDie, "Die?")) { pline("OK, so you don't %s.", (how == CHOKING) ? "choke" : "die"); savelife(how); killer.name[0] = 0; diff --git a/src/mon.c b/src/mon.c index 0e7a5501c..90cb8a14e 100644 --- a/src/mon.c +++ b/src/mon.c @@ -2383,8 +2383,9 @@ struct monst *mtmp; SUPPRESS_SADDLE | SUPPRESS_HALLUCINATION | SUPPRESS_INVISIBLE | SUPPRESS_IT, FALSE), - amorphous(mtmp->data) ? "coalesces on the" : - is_flyer(mtmp->data) ? "drops to the" : "writhes on the", + amorphous(mtmp->data) ? "coalesces on the" + : is_flyer(mtmp->data) ? "drops to the" + : "writhes on the", surface(x,y)); mtmp->mcanmove = 1; mtmp->mfrozen = 0; diff --git a/src/pager.c b/src/pager.c index 7e7cea2bc..183b73f56 100644 --- a/src/pager.c +++ b/src/pager.c @@ -526,10 +526,9 @@ boolean user_typed_name, without_asking; /* * If the object is named, then the name is the alternate description; * otherwise, the result of makesingular() applied to the name is. - * This - * isn't strictly optimal, but named objects of interest to the user - * will usually be found under their name, rather than under their - * object type, so looking for a singular form is pointless. + * This isn't strictly optimal, but named objects of interest to the + * user will usually be found under their name, rather than under + * their object type, so looking for a singular form is pointless. */ if (!alt) alt = makesingular(dbase_str); @@ -565,10 +564,11 @@ boolean user_typed_name, without_asking; if (!(ep = index(buf, '\n'))) goto bad_data_file; (void) strip_newline((ep > buf) ? ep - 1 : ep); - /* if we match a key that begins with "~", skip this entry */ + /* if we match a key that begins with "~", skip + this entry */ chk_skip = (*buf == '~') ? 1 : 0; - if ((pass == 0 && pmatch(&buf[chk_skip], dbase_str)) || - (pass == 1 && alt && pmatch(&buf[chk_skip], alt))) { + if ((pass == 0 && pmatch(&buf[chk_skip], dbase_str)) + || (pass == 1 && alt && pmatch(&buf[chk_skip], alt))) { if (chk_skip) { skipping_entry = TRUE; continue; @@ -592,7 +592,7 @@ boolean user_typed_name, without_asking; if (sscanf(buf, "%ld,%d\n", &entry_offset, &entry_count) < 2) { bad_data_file: impossible("'data' file in wrong format or corrupted"); - /* window will exist if we came here from below via 'goto' */ + /* window will exist if came here from below via 'goto' */ if (datawin != WIN_ERR) destroy_nhwindow(datawin); (void) dlb_fclose(fp); @@ -604,6 +604,7 @@ boolean user_typed_name, without_asking; unsigned maxt = strlen("More info about \"\"?"); char *entrytext = pass ? alt : dbase_str; char question[BUFSZ]; + if (strlen(entrytext) < BUFSZ - maxt) { Strcpy(question, "More info about \""); Strcat(question, entrytext); @@ -614,8 +615,8 @@ boolean user_typed_name, without_asking; } if (user_typed_name || without_asking || yes_to_moreinfo) { - if (dlb_fseek(fp, - (long) txt_offset + entry_offset, SEEK_SET) < 0) { + if (dlb_fseek(fp, (long) txt_offset + entry_offset, + SEEK_SET) < 0) { pline("? Seek error on 'data' file!"); (void) dlb_fclose(fp); return; diff --git a/src/pickup.c b/src/pickup.c index 5f484622f..c83bb8deb 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -1839,8 +1839,8 @@ reverse_loot() boxdummy = zeroobj, boxdummy.otyp = SPE_WIZARD_LOCK; (void) boxlock(coffers, &boxdummy); } - } else if (levl[x][y].looted != T_LOOTED && - (mon = makemon(courtmon(), x, y, NO_MM_FLAGS)) != 0) { + } else if (levl[x][y].looted != T_LOOTED + && (mon = makemon(courtmon(), x, y, NO_MM_FLAGS)) != 0) { freeinv(goldob); add_to_minv(mon, goldob); pline("The exchequer accepts your contribution."); diff --git a/src/vault.c b/src/vault.c index 18c1d9a16..922e571b4 100644 --- a/src/vault.c +++ b/src/vault.c @@ -377,8 +377,8 @@ invault() } trycount = 5; do { - getlin(Deaf ? "You are required to supply your name. -" : - "\"Hello stranger, who are you?\" -", buf); + getlin(Deaf ? "You are required to supply your name. -" + : "\"Hello stranger, who are you?\" -", buf); (void) mungspaces(buf); } while (!buf[0] && --trycount > 0); diff --git a/src/zap.c b/src/zap.c index 8631483e4..3ccb8059d 100644 --- a/src/zap.c +++ b/src/zap.c @@ -577,9 +577,9 @@ coord *cc; if (mtmp->m_id) { mtmp2->m_id = mtmp->m_id; /* might be bringing quest leader back to life */ - if (quest_status.leader_is_dead && + if (quest_status.leader_is_dead /* leader_is_dead implies leader_m_id is valid */ - mtmp2->m_id == quest_status.leader_m_id) + && mtmp2->m_id == quest_status.leader_m_id) quest_status.leader_is_dead = FALSE; } mtmp2->mx = mtmp->mx; @@ -708,16 +708,16 @@ boolean by_hero; break; /* x,y are 0 */ } } - if (!x || !y || + if (!x || !y /* Rules for revival from containers: - - the container cannot be locked - - the container cannot be heavily nested (>2 is arbitrary) - - the container cannot be a statue or bag of holding - (except in very rare cases for the latter) - */ - (container && (container->olocked || container_nesting > 2 - || container->otyp == STATUE - || (container->otyp == BAG_OF_HOLDING && rn2(40))))) + * - the container cannot be locked + * - the container cannot be heavily nested (>2 is arbitrary) + * - the container cannot be a statue or bag of holding + * (except in very rare cases for the latter) + */ + || (container && (container->olocked || container_nesting > 2 + || container->otyp == STATUE + || (container->otyp == BAG_OF_HOLDING && rn2(40))))) return (struct monst *) 0; /* record the object's location now that we're sure where it is */ @@ -2695,10 +2695,10 @@ struct obj *obj; /* wand or spell */ if (is_db_wall(x, y) && find_drawbridge(&xx, &yy)) { open_drawbridge(xx, yy); disclose = TRUE; - } else if (u.dz > 0 && (x == xdnstair && y == ydnstair) && + } else if (u.dz > 0 && (x == xdnstair && y == ydnstair) /* can't use the stairs down to quest level 2 until leader "unlocks" them; give feedback if you try */ - on_level(&u.uz, &qstart_level) && !ok_to_quest()) { + && on_level(&u.uz, &qstart_level) && !ok_to_quest()) { pline_The("stairs seem to ripple momentarily."); disclose = TRUE; }