From e30950ccc7c7c31c69f1d31c16b0212bbf168ceb Mon Sep 17 00:00:00 2001 From: dholland Date: Mon, 28 Jan 2008 05:38:53 +0000 Subject: Larn now builds with WARNS=4. --- larn/diag.c | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'larn/diag.c') diff --git a/larn/diag.c b/larn/diag.c index 486b2ee3..4f8ea899 100644 --- a/larn/diag.c +++ b/larn/diag.c @@ -1,9 +1,9 @@ -/* $NetBSD: diag.c,v 1.10 2006/05/11 10:23:24 mrg Exp $ */ +/* $NetBSD: diag.c,v 1.11 2008/01/28 05:38:53 dholland Exp $ */ /* diag.c Larn is copyrighted 1986 by Noah Morgan. */ #include #ifndef lint -__RCSID("$NetBSD: diag.c,v 1.10 2006/05/11 10:23:24 mrg Exp $"); +__RCSID("$NetBSD: diag.c,v 1.11 2008/01/28 05:38:53 dholland Exp $"); #endif /* not lint */ #include @@ -41,10 +41,10 @@ diag() /* for the character attributes */ - lprintf("\n\nPlayer attributes:\n\nHit points: %2d(%2d)", (long) c[HP], (long) c[HPMAX]); - lprintf("\ngold: %d Experience: %d Character level: %d Level in caverns: %d", + lprintf("\n\nPlayer attributes:\n\nHit points: %2ld(%2ld)", (long) c[HP], (long) c[HPMAX]); + lprintf("\ngold: %ld Experience: %ld Character level: %ld Level in caverns: %ld", (long) c[GOLD], (long) c[EXPERIENCE], (long) c[LEVEL], (long) level); - lprintf("\nTotal types of monsters: %d", (long) MAXMONST + 8); + lprintf("\nTotal types of monsters: %ld", (long) MAXMONST + 8); lprcat("\f\nHere's the dungeon:\n\n"); @@ -60,9 +60,9 @@ diag() lprcat(" Monster Name LEV AC DAM ATT DEF GOLD HP EXP \n"); lprcat("--------------------------------------------------------------------------\n"); for (i = 0; i <= MAXMONST + 8; i++) { - lprintf("%19s %2d %3d ", monster[i].name, (long) monster[i].level, (long) monster[i].armorclass); - lprintf(" %3d %3d %3d ", (long) monster[i].damage, (long) monster[i].attack, (long) monster[i].defense); - lprintf("%6d %3d %6d\n", (long) monster[i].gold, (long) monster[i].hitpoints, (long) monster[i].experience); + lprintf("%19s %2ld %3ld ", monster[i].name, (long) monster[i].level, (long) monster[i].armorclass); + lprintf(" %3ld %3ld %3ld ", (long) monster[i].damage, (long) monster[i].attack, (long) monster[i].defense); + lprintf("%6ld %3ld %6ld\n", (long) monster[i].gold, (long) monster[i].hitpoints, (long) monster[i].experience); } lprcat("\n\nHere's a Table for the to hit percentages\n"); @@ -77,7 +77,7 @@ diag() for (i = 0; i <= MAXMONST + 8; i++) { hit = 2 * monster[i].armorclass + 2 * monster[i].level + 16; dam = 16 - c[HARDGAME]; - lprintf("\n%20s %2d/%2d/%2d %2d/%2d/%2d %2d/%2d/%2d", + lprintf("\n%20s %2ld/%2ld/%2ld %2ld/%2ld/%2ld %2ld/%2ld/%2ld", monster[i].name, (long) (hit / 2), (long) max(0, dam + 2), (long) (monster[i].hitpoints / (dam + 2) + 1), (long) ((hit + 2) / 2), (long) max(0, dam + 10), (long) (monster[i].hitpoints / (dam + 10) + 1), @@ -101,9 +101,9 @@ diag() lprcat("\n\nFor the c[] array:\n"); for (j = 0; j < 100; j += 10) { - lprintf("\nc[%2d] = ", (long) j); + lprintf("\nc[%2ld] = ", (long) j); for (i = 0; i < 9; i++) - lprintf("%5d ", (long) c[i + j]); + lprintf("%5ld ", (long) c[i + j]); } lprcat("\n\nTest of random number generator ----------------"); @@ -114,7 +114,7 @@ diag() for (i = 0; i < 25000; i++) rndcount[rund(16)]++; for (i = 0; i < 16; i++) { - lprintf(" %5d", (long) rndcount[i]); + lprintf(" %5ld", (long) rndcount[i]); if (i == 7) lprc('\n'); } @@ -221,7 +221,7 @@ savegame(fname) time(&zzz); lprint((long) (zzz - initialtime)); lwrite((char *) &zzz, sizeof(long)); - if (fstat(lfd, &statbuf) < 0) + if (fstat(io_outfd, &statbuf) < 0) lprint(0L); else lprint((long) statbuf.st_ino); /* inode # */ @@ -305,8 +305,8 @@ restoregame(fname) time(&zzz); initialtime = zzz - larn_lrint(); - fstat(fd, &filetimes); /* get the creation and modification time of - * file */ + /* get the creation and modification time of file */ + fstat(io_infd, &filetimes); lrfill((char *) &zzz, sizeof(long)); zzz += 6; if (filetimes.st_ctime > zzz) @@ -318,8 +318,9 @@ restoregame(fname) return; } /* died a post mortem death */ oldx = oldy = 0; + /* XXX the following will break on 64-bit inode numbers */ i = larn_lrint(); /* inode # */ - if (i && (filetimes.st_ino != i)) + if (i && (filetimes.st_ino != (ino_t) i)) fsorry(); lrclose(); if (strcmp(fname, ckpfile) == 0) { -- cgit v1.2.3-56-ge451