]> git.cameronkatri.com Git - bsdgames-darwin.git/blobdiff - monop/morg.c
Sanity fixes for input buffer handling. From OpenBSD
[bsdgames-darwin.git] / monop / morg.c
index 80860f63838f39e1e2372ee5afaff4eb5545c959..faf720961fcdd0db56f7e9a4195aedcc3251e88e 100644 (file)
@@ -1,4 +1,4 @@
-/*     $NetBSD: morg.c,v 1.7 1999/08/21 10:40:04 simonb Exp $  */
+/*     $NetBSD: morg.c,v 1.14 2008/02/20 05:08:46 dholland Exp $       */
 
 /*
  * Copyright (c) 1980, 1993
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *     This product includes software developed by the University of
- *     California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  *
@@ -38,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)morg.c     8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: morg.c,v 1.7 1999/08/21 10:40:04 simonb Exp $");
+__RCSID("$NetBSD: morg.c,v 1.14 2008/02/20 05:08:46 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -48,8 +44,8 @@ __RCSID("$NetBSD: morg.c,v 1.7 1999/08/21 10:40:04 simonb Exp $");
  *     These routines deal with mortgaging.
  */
 
-static char    *names[MAX_PRP+2],
-               *morg_coms[]    = {
+static const char      *names[MAX_PRP+2],
+               *const morg_coms[]      = {
                        "quit",         /*  0 */
                        "print",        /*  1 */
                        "where",        /*  2 */
@@ -70,14 +66,14 @@ static char *names[MAX_PRP+2],
 
 static short   square[MAX_PRP+2];
 
-static int     num_good,got_houses;
+static int     num_good, got_houses;
 
 
-static int set_mlist __P((void));
-static void m __P((int));
-static int set_umlist __P((void));
-static void unm __P((int));
-static void fix_ex __P((int));
+static int set_mlist(void);
+static void m(int);
+static int set_umlist(void);
+static void unm(int);
+static void fix_ex(int);
 
 /*
  *     This routine is the command level response the mortgage command.
@@ -87,7 +83,7 @@ static void fix_ex __P((int));
 void
 mortgage()
 {
-       int prop;
+       int propnum;
 
        for (;;) {
                if (set_mlist() == 0) {
@@ -106,10 +102,11 @@ mortgage()
                                m(square[0]);
                        return;
                }
-               prop = getinp("Which property do you want to mortgage? ",names);
-               if (prop == num_good)
+               propnum = getinp("Which property do you want to mortgage? ",
+                               names);
+               if (propnum == num_good)
                        return;
-               m(square[prop]);
+               m(square[propnum]);
                notify();
        }
 }
@@ -141,13 +138,13 @@ set_mlist()
  *     This routine actually mortgages the property.
  */
 static void
-m(prop)
-       int prop;
+m(propnum)
+       int propnum;
 {
        int price;
 
-       price = board[prop].cost/2;
-       board[prop].desc->morg = TRUE;
+       price = board[propnum].cost/2;
+       board[propnum].desc->morg = TRUE;
        printf("That got you $%d\n",price);
        cur_p->money += price;
 }
@@ -158,9 +155,9 @@ m(prop)
  * to be unmortgaged.
  */
 void
-unmortgage() 
+unmortgage()
 {
-       int prop;
+       int propnum;
 
        for (;;) {
                if (set_umlist() == 0) {
@@ -173,11 +170,11 @@ unmortgage()
                                unm(square[0]);
                        return;
                }
-               prop = getinp("Which property do you want to unmortgage? ",
+               propnum = getinp("Which property do you want to unmortgage? ",
                    names);
-               if (prop == num_good)
+               if (propnum == num_good)
                        return;
-               unm(square[prop]);
+               unm(square[propnum]);
        }
 }
 
@@ -204,13 +201,13 @@ set_umlist()
  *     This routine actually unmortgages the property
  */
 static void
-unm(prop)
-       int prop
+unm(propnum)
+       int propnum;
 {
        int price;
 
-       price = board[prop].cost/2;
-       board[prop].desc->morg = FALSE;
+       price = board[propnum].cost/2;
+       board[propnum].desc->morg = FALSE;
        price += price/10;
        printf("That cost you $%d\n",price);
        cur_p->money -= price;