From a637e91f376c6e37160ba24b987e545953759d2a Mon Sep 17 00:00:00 2001 From: PatR Date: Wed, 9 Jan 2019 18:15:43 -0800 Subject: [PATCH] miscellaneous formatting Some minor stuff that's been sitting around for a while. --- src/do.c | 15 +++++++-------- src/dokick.c | 19 ++++++++++--------- src/lock.c | 11 ++++++----- src/mkobj.c | 10 +++++----- src/potion.c | 17 +++++++++-------- 5 files changed, 37 insertions(+), 35 deletions(-) diff --git a/src/do.c b/src/do.c index b05339df4..53d0c60ae 100644 --- a/src/do.c +++ b/src/do.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 do.c $NHDT-Date: 1545597418 2018/12/23 20:36:58 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.182 $ */ +/* NetHack 3.6 do.c $NHDT-Date: 1547086513 2019/01/10 02:15:13 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.183 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Derek S. Ray, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -371,7 +371,7 @@ register struct obj *obj; goto giveback; case RIN_SLOW_DIGESTION: pline_The("ring is regurgitated!"); - giveback: + giveback: obj->in_use = FALSE; dropx(obj); trycall(obj); @@ -890,7 +890,7 @@ int retry; } } -drop_done: + drop_done: return n_dropped; } @@ -1698,17 +1698,16 @@ struct obj *corpse; where = corpse->where; is_uwep = (corpse == uwep); chewed = (corpse->oeaten != 0); - Strcpy(cname, - corpse_xname(corpse, chewed ? "bite-covered" : (const char *) 0, - CXN_SINGULAR)); + Strcpy(cname, corpse_xname(corpse, + chewed ? "bite-covered" : (const char *) 0, + CXN_SINGULAR)); mcarry = (where == OBJ_MINVENT) ? corpse->ocarry : 0; if (where == OBJ_CONTAINED) { struct monst *mtmp2; container = corpse->ocontainer; - mtmp2 = - get_container_location(container, &container_where, (int *) 0); + mtmp2 = get_container_location(container, &container_where, (int *) 0); /* container_where is the outermost container's location even if * nested */ if (container_where == OBJ_MINVENT && mtmp2) diff --git a/src/dokick.c b/src/dokick.c index 68eb49c24..04d33e3e2 100644 --- a/src/dokick.c +++ b/src/dokick.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 dokick.c $NHDT-Date: 1543185070 2018/11/25 22:31:10 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.128 $ */ +/* NetHack 3.6 dokick.c $NHDT-Date: 1547086527 2019/01/10 02:15:27 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.129 $ */ /* Copyright (c) Izchak Miller, Mike Stephenson, Steve Linhart, 1989. */ /* NetHack may be freely redistributed. See license for details. */ @@ -247,7 +247,7 @@ xchar x, y; else if (uarm && objects[uarm->otyp].oc_bulky && ACURR(A_DEX) < rnd(25)) clumsy = TRUE; -doit: + doit: You("kick %s.", mon_nam(mon)); if (!rn2(clumsy ? 3 : 4) && (clumsy || !bigmonst(mon->data)) && mon->mcansee && !mon->mtrapped && !thick_skinned(mon->data) @@ -1203,7 +1203,7 @@ dokick() || IS_STWALL(maploc->typ)) { if (!IS_STWALL(maploc->typ) && maploc->ladder == LA_DOWN) goto dumb; - ouch: + ouch: pline("Ouch! That hurts!"); exercise(A_DEX, FALSE); exercise(A_STR, FALSE); @@ -1230,7 +1230,7 @@ dokick() if (maploc->doormask == D_ISOPEN || maploc->doormask == D_BROKEN || maploc->doormask == D_NODOOR) { - dumb: + dumb: exercise(A_DEX, FALSE); if (martial() || ACURR(A_DEX) >= 16 || rn2(3)) { You("kick at empty space."); @@ -1412,10 +1412,11 @@ xchar dlev; /* if !0 send to dlev near player */ obj_extract_self(obj); if (costly) { - price += stolen_value( - obj, x, y, (costly_spot(u.ux, u.uy) - && index(u.urooms, *in_rooms(x, y, SHOPBASE))), - TRUE); + price += stolen_value(obj, x, y, + (costly_spot(u.ux, u.uy) + && index(u.urooms, + *in_rooms(x, y, SHOPBASE))), + TRUE); /* set obj->no_charge to 0 */ if (Has_contents(obj)) picked_container(obj); /* does the right thing */ @@ -1681,7 +1682,7 @@ unsigned long deliverflags; struct obj *otmp, *otmp2; int where, maxobj = 1; boolean at_crime_scene = In_mines(&u.uz); - + if ((deliverflags & DF_RANDOM) && cnt > 1) maxobj = rnd(cnt); else if (deliverflags & DF_ALL) diff --git a/src/lock.c b/src/lock.c index 5c52532b9..0f4c4dbff 100644 --- a/src/lock.c +++ b/src/lock.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 lock.c $NHDT-Date: 1544442712 2018/12/10 11:51:52 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.82 $ */ +/* NetHack 3.6 lock.c $NHDT-Date: 1547086531 2019/01/10 02:15:31 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.83 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */ /* NetHack may be freely redistributed. See license for details. */ @@ -195,12 +195,13 @@ boolean destroyit; if (!rn2(3) || otmp->oclass == POTION_CLASS) { chest_shatter_msg(otmp); if (costly) - loss += - stolen_value(otmp, u.ux, u.uy, peaceful_shk, TRUE); + loss += stolen_value(otmp, u.ux, u.uy, peaceful_shk, TRUE); if (otmp->quan == 1L) { obfree(otmp, (struct obj *) 0); continue; } + /* this works because we're sure to have at least 1 left; + otherwise it would fail since otmp is not in inventory */ useup(otmp); } if (box->otyp == ICE_BOX && otmp->otyp == CORPSE) { @@ -746,7 +747,7 @@ boolean quietly; return TRUE; } if (OBJ_AT(x, y)) { - objhere: + objhere: if (!quietly) pline("%s's in the way.", Something); return TRUE; @@ -812,7 +813,7 @@ doclose() else if (portcullis || door->typ == DRAWBRIDGE_DOWN) There("is no obvious way to close the drawbridge."); else { - nodoor: + nodoor: You("%s no door there.", Blind ? "feel" : "see"); } return res; diff --git a/src/mkobj.c b/src/mkobj.c index 29444b424..0c6b960ca 100644 --- a/src/mkobj.c +++ b/src/mkobj.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 mkobj.c $NHDT-Date: 1546837153 2019/01/07 04:59:13 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.140 $ */ +/* NetHack 3.6 mkobj.c $NHDT-Date: 1547086532 2019/01/10 02:15:32 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.141 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Derek S. Ray, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -71,7 +71,7 @@ newoextra() { struct oextra *oextra; - oextra = (struct oextra *) alloc(sizeof(struct oextra)); + oextra = (struct oextra *) alloc(sizeof (struct oextra)); oextra->oname = 0; oextra->omonst = 0; oextra->omid = 0; @@ -391,7 +391,7 @@ struct obj *obj2, *obj1; if (!OMONST(obj2)) newomonst(obj2); (void) memcpy((genericptr_t) OMONST(obj2), - (genericptr_t) OMONST(obj1), sizeof(struct monst)); + (genericptr_t) OMONST(obj1), sizeof (struct monst)); OMONST(obj2)->mextra = (struct mextra *) 0; OMONST(obj2)->nmon = (struct monst *) 0; #if 0 @@ -406,13 +406,13 @@ struct obj *obj2, *obj1; if (!OMID(obj2)) newomid(obj2); (void) memcpy((genericptr_t) OMID(obj2), (genericptr_t) OMID(obj1), - sizeof(unsigned)); + sizeof (unsigned)); } if (has_olong(obj1)) { if (!OLONG(obj2)) newolong(obj2); (void) memcpy((genericptr_t) OLONG(obj2), (genericptr_t) OLONG(obj1), - sizeof(long)); + sizeof (long)); } if (has_omailcmd(obj1)) { new_omailcmd(obj2, OMAILCMD(obj1)); diff --git a/src/potion.c b/src/potion.c index 482321692..dc2613a34 100644 --- a/src/potion.c +++ b/src/potion.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 potion.c $NHDT-Date: 1545597429 2018/12/23 20:37:09 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.157 $ */ +/* NetHack 3.6 potion.c $NHDT-Date: 1547086533 2019/01/10 02:15:33 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.158 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1402,7 +1402,7 @@ int how; /*FALLTHRU*/ case POT_RESTORE_ABILITY: case POT_GAIN_ABILITY: - do_healing: + do_healing: angermon = FALSE; if (mon->mhp < mon->mhpmax) { mon->mhp = mon->mhpmax; @@ -1424,7 +1424,7 @@ int how; pline("%s looks unharmed.", Monnam(mon)); break; } - do_illness: + do_illness: if ((mon->mhpmax > 3) && !resist(mon, POTION_CLASS, 0, NOTELL)) mon->mhpmax /= 2; if ((mon->mhp > 2) && !resist(mon, POTION_CLASS, 0, NOTELL)) @@ -2146,7 +2146,7 @@ dodip() useup(potion); return 1; } -more_dips: + more_dips: /* Allow filling of MAGIC_LAMPs to prevent identification by player */ if ((obj->otyp == OIL_LAMP || obj->otyp == MAGIC_LAMP) @@ -2234,9 +2234,10 @@ more_dips: } } obj_extract_self(singlepotion); - singlepotion = - hold_another_object(singlepotion, "You juggle and drop %s!", - doname(singlepotion), (const char *) 0); + singlepotion = hold_another_object(singlepotion, + "You juggle and drop %s!", + doname(singlepotion), + (const char *) 0); nhUse(singlepotion); update_inventory(); return 1; @@ -2245,7 +2246,7 @@ more_dips: pline("Interesting..."); return 1; -poof: + poof: if (!objects[potion->otyp].oc_name_known && !objects[potion->otyp].oc_uname) docall(potion); -- 2.40.0