]> granicus.if.org Git - nethack/commitdiff
Silence GCC warnings
authorPasi Kallinen <paxed@alt.org>
Tue, 31 Mar 2015 05:36:32 +0000 (08:36 +0300)
committerPasi Kallinen <paxed@alt.org>
Tue, 31 Mar 2015 05:36:36 +0000 (08:36 +0300)
...when compiling with -Wall --pedantic

src/cmd.c
src/dig.c
src/dog.c
src/mkroom.c
src/potion.c
src/read.c
src/restore.c
src/trap.c

index 51bc10896cd3c428dacb0d3e0c6fcc4423af83a9..8b74085337e50518ec66cbff2c39146f28b6834c 100644 (file)
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -997,11 +997,8 @@ wiz_levltyp_legend(VOID_ARGS)
 STATIC_PTR int
 wiz_smell(VOID_ARGS)
 {
-       char    out_str[BUFSZ];
-       struct permonst *pm = 0;
        int     ans = 0;
        int     mndx;           /* monster index */
-       int     found;          /* count of matching mndxs found */
        coord   cc;             /* screen pos of unknown glyph */
        int glyph;              /* glyph at selected position */
 
@@ -1015,11 +1012,6 @@ wiz_smell(VOID_ARGS)
 
        pline("You can move the cursor to a monster that you want to smell.");
        do {
-               /* Reset some variables. */
-               pm = (struct permonst *)0;
-               found = 0;
-               out_str[0] = '\0';
-       
                pline("Pick a monster to smell.");
                ans = getpos(&cc, TRUE, "a monster");
                if (ans < 0 || cc.x < 0) {
index f50d8aa76b46c7a00ab5bcb68eff5b94673c3568..a99c93729b6893eee24e3ccc9b2ecdfe169a0b62 100644 (file)
--- a/src/dig.c
+++ b/src/dig.c
@@ -1284,7 +1284,7 @@ zap_dig()
        struct monst *mtmp;
        struct obj *otmp;
        struct trap *trap_with_u = (struct trap *)0;
-       int zx, zy, diridx, digdepth, flow_x, flow_y;
+       int zx, zy, diridx = 8, digdepth, flow_x = -1, flow_y = -1;
        boolean shopdoor, shopwall, maze_dig, pitdig = FALSE, pitflow = FALSE;
 
        /*
@@ -1462,7 +1462,7 @@ zap_dig()
        } /* while */
        tmp_at(DISP_END,0);     /* closing call */
 
-       if (pitflow) {
+       if (pitflow && isok(flow_x, flow_y)) {
                struct trap *ttmp  = t_at(flow_x, flow_y);
                if (ttmp && (ttmp->ttyp == PIT || ttmp->ttyp == SPIKED_PIT)) {
                        schar filltyp = fillholetyp(ttmp->tx, ttmp->ty, TRUE);
index fcc258b869bd8129a10c675212d6bebecdf32a90..10e33677f564f04dec2c4df3cb71db93a7674ab4 100644 (file)
--- a/src/dog.c
+++ b/src/dog.c
@@ -423,7 +423,7 @@ boolean with_you;
                 * probably because the level is full.
                 * Dump the monster's cargo and leave the monster dead.
                 */
-               struct obj *obj, *corpse;
+               struct obj *obj;
                while ((obj = mtmp->minvent) != 0) {
                    obj_extract_self(obj);
                    obj_no_longer_held(obj);
@@ -437,7 +437,7 @@ boolean with_you;
                            impossible("Can't find relocated object.");
                    }
                }
-               corpse = mkcorpstat(CORPSE, (struct monst *)0, mtmp->data,
+               (void) mkcorpstat(CORPSE, (struct monst *)0, mtmp->data,
                                xlocale, ylocale, CORPSTAT_NONE);
                mongone(mtmp);
            }
index 2581ce9964d6f354cbe13e10c0e5d6578ff3a767..6ef03054a0cbf9f4ca70efd9fa02a13c4352ff8e 100644 (file)
@@ -219,14 +219,10 @@ struct mkroom *sroom;
 {
        struct monst *mon;
        register int sx,sy,i;
-       int sh, tx, ty, goldlim, type = sroom->rtype;
+       int sh, tx = 0, ty = 0, goldlim = 0, type = sroom->rtype;
        int rmno = (int)((sroom - rooms) + ROOMOFFSET);
        coord mm;
 
-#ifdef GCC_WARN
-       tx = ty = goldlim = 0;
-#endif
-
        sh = sroom->fdoor;
        switch(type) {
            case COURT:
index d32c65b65884aefc0d2d81cfd79d66809b7879e5..86fdcdff8d57665fe93445cecd0757a61eb9d887 100644 (file)
@@ -1055,7 +1055,7 @@ boolean useeit;
 const char *objphrase; /* "Your widget glows" or "Steed's saddle glows" */
 {
     void FDECL((*func), (OBJ_P)) = 0;
-    const char *how = 0, *glowcolor = 0;
+    const char *glowcolor = 0;
 #define COST_alter (-2)
 #define COST_none  (-1)
     int costchange = COST_none;
@@ -1064,7 +1064,6 @@ const char *objphrase;    /* "Your widget glows" or "Steed's saddle glows" */
     if (!potion || potion->otyp != POT_WATER) return FALSE;
 
     if (potion->blessed) {
-       how = "softly glow";
        if (targobj->cursed) {
            func = uncurse;
            glowcolor = NH_AMBER;
@@ -1076,7 +1075,6 @@ const char *objphrase;    /* "Your widget glows" or "Steed's saddle glows" */
            altfmt = TRUE;      /* "with a <color> aura" */
        }
     } else if (potion->cursed) {
-       how = "glow";
        if (targobj->blessed) {
            func = unbless;
            glowcolor = "brown";
index 3ad28e8aa5e5491bb2a8756db181a47e0329d619..7d35620bc94af7d21484935590a9b8b460f9c133 100644 (file)
@@ -2198,7 +2198,7 @@ create_particular()
 {
        char buf[BUFSZ], *bufp, monclass;
        int which, tryct, i, firstchoice = NON_PM;
-       struct permonst *whichpm;
+       struct permonst *whichpm = NULL;
        struct monst *mtmp;
        boolean madeany = FALSE;
        boolean maketame, makepeaceful, makehostile;
index be1126be853c08f3cb8b2a866cc13cfa5c32d1fb..4c4b049ceb0aad7b63f37ce1ebf4cbe98de482ad 100644 (file)
@@ -1144,9 +1144,9 @@ get_plname_from_file(fd, plbuf)
 int fd;
 char *plbuf;
 {
-       int rlen, pltmpsiz = 0;
-       rlen = read(fd, (genericptr_t) &pltmpsiz, sizeof(pltmpsiz));
-       rlen = read(fd, (genericptr_t) plbuf, pltmpsiz);
+       int pltmpsiz = 0;
+       (void) read(fd, (genericptr_t) &pltmpsiz, sizeof(pltmpsiz));
+       (void) read(fd, (genericptr_t) plbuf, pltmpsiz);
        return;
 }
 
index 775bca5cb1855220ed3a7537ba9d135d433d9d54..4c8adccbd7e08da88dba00537151e62f77aad130 100644 (file)
@@ -1406,13 +1406,12 @@ struct obj *otmp;
 {
        struct monst *steed = u.usteed;
        int tt;
-       boolean in_sight, trapkilled, steedhit;
+       boolean trapkilled, steedhit;
 
        if (!steed || !trap) return 0;
        tt = trap->ttyp;
        steed->mx = u.ux;
        steed->my = u.uy;
-       in_sight = !Blind;
        trapkilled = steedhit = FALSE;
 
        switch (tt) {
@@ -4266,7 +4265,7 @@ boolean trapdoor_only;
 boolean *noticed;      /* set to true iff hero notices the effect; */
 {                      /* otherwise left with its previous value intact */
     struct trap *t;
-    boolean ishero = (mon == &youmonst), result;
+    boolean ishero = (mon == &youmonst);
 
     if (mon == u.usteed) ishero = TRUE;
     t = t_at(ishero ? u.ux : mon->mx, ishero ? u.uy : mon->my);
@@ -4281,7 +4280,6 @@ boolean *noticed; /* set to true iff hero notices the effect; */
        if (u.utrap) return FALSE;      /* already trapped */
        *noticed = TRUE;
        dotrap(t, FORCETRAP);
-       result = (u.utrap != 0);
     } else {
        if (mon->mtrapped) return FALSE;        /* already trapped */
        /* you notice it if you see the trap close/tremble/whatever
@@ -4290,7 +4288,6 @@ boolean *noticed; /* set to true iff hero notices the effect; */
        /* monster will be angered; mintrap doesn't handle that */
        wakeup(mon);
        ++force_mintrap;
-       result = (mintrap(mon) != 0);
        --force_mintrap;
        /* mon might now be on the migrating monsters list */
     }