From: PatR Date: Tue, 17 Mar 2015 02:22:49 +0000 (-0700) Subject: some lint cleanup X-Git-Tag: NetHack-3.6.0_RC01~593 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ad03a7fb7a40ac908a03cc8ba16d14138d13c2ba;p=nethack some lint cleanup --- diff --git a/src/do_name.c b/src/do_name.c index f1960b6ff..37daffbc4 100644 --- a/src/do_name.c +++ b/src/do_name.c @@ -1,4 +1,4 @@ -/* NetHack 3.5 do_name.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ +/* NetHack 3.5 do_name.c $NHDT-Date: 1426558927 2015/03/17 02:22:07 $ $NHDT-Branch: master $:$NHDT-Revision: 1.53 $ */ /* NetHack 3.5 do_name.c $Date: 2012/01/29 03:00:17 $ $Revision: 1.49 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -56,8 +56,8 @@ const char *goal; } int -getpos(cc, force, goal) -coord *cc; +getpos(ccp, force, goal) +coord *ccp; boolean force; const char *goal; { @@ -75,8 +75,8 @@ const char *goal; pline("(For instructions type a ?)"); msg_given = TRUE; } - cx = cc->x; - cy = cc->y; + cx = ccp->x; + cy = ccp->y; #ifdef CLIPPING cliparound(cx, cy); #endif @@ -97,6 +97,7 @@ const char *goal; int sym = 0; char tmpbuf[BUFSZ]; const char *firstmatch = NULL; + cc.x = cx; cc.y = cy; if (do_screen_description(cc, TRUE, sym, tmpbuf, &firstmatch)) { @@ -250,8 +251,8 @@ const char *goal; lock_mouse_cursor(FALSE); #endif if (msg_given) clear_nhwindow(WIN_MESSAGE); - cc->x = cx; - cc->y = cy; + ccp->x = cx; + ccp->y = cy; return result; } diff --git a/src/pickup.c b/src/pickup.c index 7b3096c59..3eba9874f 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -1,4 +1,4 @@ -/* NetHack 3.5 pickup.c $NHDT-Date: 1426465438 2015/03/16 00:23:58 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.130 $ */ +/* NetHack 3.5 pickup.c $NHDT-Date: 1426558927 2015/03/17 02:22:07 $ $NHDT-Branch: master $:$NHDT-Revision: 1.131 $ */ /* NetHack 3.5 pickup.c $Date: 2012/02/16 03:01:38 $ $Revision: 1.123 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1515,7 +1515,7 @@ doloot() /* loot a container on the floor or loot saddle from mon. */ lootcont: if (container_at(cc.x, cc.y, FALSE)) { - boolean any = FALSE; + boolean anyfound = FALSE; int num_conts = 0; if (!able_to_loot(cc.x, cc.y, TRUE)) return 0; @@ -1563,14 +1563,14 @@ lootcont: cobj, doname, ansimpleoname, "a container")); if (c == 'q') return (timepassed); if (c == 'n') continue; - any = TRUE; + anyfound = TRUE; timepassed |= do_loot_cont(&cobj); /* might have triggered chest trap or magic bag explosion */ if (multi < 0 || !cobj) return 1; } } - if (any) c = 'y'; + if (anyfound) c = 'y'; } } else if (IS_GRAVE(levl[cc.x][cc.y].typ)) { You("need to dig up the grave to effectively loot it..."); diff --git a/src/role.c b/src/role.c index 9e09d448a..bf4d66de7 100644 --- a/src/role.c +++ b/src/role.c @@ -1,4 +1,4 @@ -/* NetHack 3.5 role.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ +/* NetHack 3.5 role.c $NHDT-Date: 1426558928 2015/03/17 02:22:08 $ $NHDT-Branch: master $:$NHDT-Revision: 1.21 $ */ /* NetHack 3.5 role.c $Date: 2012/02/16 03:01:38 $ $Revision: 1.18 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985-1999. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1333,14 +1333,16 @@ plnamesuffix() int i; #ifdef GENERIC_USERNAMES - /* some generic user names will be ignored in favor of prompting */ - i = (int)strlen(plname); - eptr = GENERIC_USERNAMES; - sptr = strstri(eptr, plname); - if (sptr - && (sptr == eptr || sptr[-1] == ' ') - && (sptr[i] == ' ' || sptr[i] == '\0')) - *plname = '\0'; /* call askname() */ + { + /* some generic user names will be ignored in favor of prompting */ + const char *uptr = GENERIC_USERNAMES; + + i = (int)strlen(plname); + if ((sptr = strstri(uptr, plname)) != 0 + && (sptr == uptr || sptr[-1] == ' ') + && (sptr[i] == ' ' || sptr[i] == '\0')) + *plname = '\0'; /* call askname() */ + } #endif do { diff --git a/src/trap.c b/src/trap.c index 911aafdc5..36c1ee632 100644 --- a/src/trap.c +++ b/src/trap.c @@ -1,4 +1,4 @@ -/* NetHack 3.5 trap.c $NHDT-Date: 1425318721 2015/03/02 17:52:01 $ $NHDT-Branch: master $:$NHDT-Revision: 1.194 $ */ +/* NetHack 3.5 trap.c $NHDT-Date: 1426558928 2015/03/17 02:22:08 $ $NHDT-Branch: master $:$NHDT-Revision: 1.195 $ */ /* NetHack 3.5 trap.c $Date: 2013/03/14 01:58:21 $ $Revision: 1.179 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -3016,7 +3016,6 @@ xchar x, y; { int chance; struct obj *otmp, *ncobj; - int retval = 0; int in_sight = !Blind && couldsee(x, y); /* Don't care if it's lit */ int dindx; @@ -3158,7 +3157,7 @@ struct obj *obj; const char *ostr; boolean force; { - boolean loose_obj = (obj && obj->where == OBJ_FREE), exploded = FALSE; + boolean exploded = FALSE; if (snuff_lit(obj)) return ER_DAMAGED; @@ -3214,11 +3213,6 @@ boolean force; (one ? "Another" : "More"), bufp, vtense(bufp, "explode")); exploded = TRUE; - /* let caller know that obj has gone away - [when obj is part of a list, delobj()'s - obj_extract_self() takes care of this; - for loose_obj, obj should always equal - *objp and otmp should always be null] */ setnotworn(obj); delobj(obj); if (update)