]> git.cameronkatri.com Git - bsdgames-darwin.git/blobdiff - larn/moreobj.c
Larn now builds with WARNS=4.
[bsdgames-darwin.git] / larn / moreobj.c
index b9ace54662f2d4309af5f92d4d8e5ebed1d9b84a..70853acb24feaf905b2a739a94d2419962d23477 100644 (file)
@@ -1,4 +1,4 @@
-/*     $NetBSD: moreobj.c,v 1.7 2008/01/28 03:39:31 dholland Exp $     */
+/*     $NetBSD: moreobj.c,v 1.8 2008/01/28 05:38:54 dholland Exp $     */
 
 /*
  * moreobj.c           Larn is copyrighted 1986 by Noah Morgan.
 
 /*
  * moreobj.c           Larn is copyrighted 1986 by Noah Morgan.
@@ -9,7 +9,7 @@
  */
 #include <sys/cdefs.h>
 #ifndef lint
  */
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: moreobj.c,v 1.7 2008/01/28 03:39:31 dholland Exp $");
+__RCSID("$NetBSD: moreobj.c,v 1.8 2008/01/28 05:38:54 dholland Exp $");
 #endif                         /* not lint */
 #include <stdlib.h>
 #include <unistd.h>
 #endif                         /* not lint */
 #include <stdlib.h>
 #include <unistd.h>
@@ -29,7 +29,7 @@ static void fch(int, long *);
 void
 oaltar()
 {
 void
 oaltar()
 {
-       unsigned long   k;
+       long amt;
 
        lprcat("\nDo you (p) pray  (d) desecrate");
        iopts();
 
        lprcat("\nDo you (p) pray  (d) desecrate");
        iopts();
@@ -66,13 +66,13 @@ oaltar()
                                                cursor(1, 23);
                                                cltoeoln();
                                                lprcat("how much do you donate? ");
                                                cursor(1, 23);
                                                cltoeoln();
                                                lprcat("how much do you donate? ");
-                                               k = readnum((long) c[GOLD]);
-                                               if (c[GOLD] < k) {
+                                               amt = readnum((long) c[GOLD]);
+                                               if (amt < 0 || c[GOLD] < amt) {
                                                        lprcat("\nYou don't have that much!");
                                                        return;
                                                }
                                                        lprcat("\nYou don't have that much!");
                                                        return;
                                                }
-                                               c[GOLD] -= k;
-                                               if (k < c[GOLD] / 10 || k < rnd(50)) {
+                                               c[GOLD] -= amt;
+                                               if (amt < c[GOLD] / 10 || amt < rnd(50)) {
                                                        createmonster(makemonst(level + 1));
                                                        c[AGGRAVATE] += 200;
                                                } else if (rnd(101) > 50) {
                                                        createmonster(makemonst(level + 1));
                                                        c[AGGRAVATE] += 200;
                                                } else if (rnd(101) > 50) {