]> git.cameronkatri.com Git - bsdgames-darwin.git/blobdiff - battlestar/room.c
Heads up on Bell patents
[bsdgames-darwin.git] / battlestar / room.c
index ddcd1fa433c61028ed8b587c1967ebbebebb1439..16d129b5a1c152ea515af5edc93a5e4f395db514 100644 (file)
@@ -1,4 +1,4 @@
-/*     $NetBSD: room.c,v 1.8 2000/09/08 17:22:02 jsm Exp $     */
+/*     $NetBSD: room.c,v 1.14 2019/10/05 23:34:14 mrg Exp $    */
 
 /*
  * Copyright (c) 1983, 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.
  *
 #if 0
 static char sccsid[] = "@(#)room.c     8.2 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: room.c,v 1.8 2000/09/08 17:22:02 jsm Exp $");
+__RCSID("$NetBSD: room.c,v 1.14 2019/10/05 23:34:14 mrg Exp $");
 #endif
 #endif                         /* not lint */
 
 #include "extern.h"
 
 void
-writedes()
+writedes(void)
 {
        int     compass;
        const char   *p;
        int     c;
 
        printf("\n\t%s\n", location[position].name);
-       if (beenthere[position] < ROOMDESC) {
+       if (beenthere[position] < ROOMDESC || verbose) {
                compass = NORTH;
                for (p = location[position].desc; (c = *p++) != 0;)
-                       if (c != '-' && c != '*' && c != '+')
-                               putchar(c);
-                       else {
+                       if (c != '-' && c != '*' && c != '+') {
+                               if (c == '=')
+                                       putchar('-');
+                               else
+                                       putchar(c);
+                       } else {
                                if (c != '*')
-                                       printf(truedirec(compass, c));
+                                       printf("%s", truedirec(compass, c));
                                compass++;
                        }
        }
 }
 
 void
-printobjs()
+printobjs(void)
 {
        unsigned int *p = location[position].objects;
        int     n;
@@ -78,8 +77,7 @@ printobjs()
 }
 
 void
-whichway(here)
-       struct room here;
+whichway(struct room here)
 {
        switch (direction) {
 
@@ -114,10 +112,8 @@ whichway(here)
        }
 }
 
-const char   *
-truedirec(way, option)
-       int     way;
-       char    option;
+const char *
+truedirec(int way, int option)
 {
        switch (way) {
 
@@ -133,6 +129,7 @@ truedirec(way, option)
                case WEST:
                        return ("right");
                }
+               break;
 
        case SOUTH:
                switch (direction) {
@@ -146,6 +143,7 @@ truedirec(way, option)
                case WEST:
                        return ("left");
                }
+               break;
 
        case EAST:
                switch (direction) {
@@ -159,6 +157,7 @@ truedirec(way, option)
                        return (option == '+' ? "behind you" :
                            "back");
                }
+               break;
 
        case WEST:
                switch (direction) {
@@ -172,16 +171,16 @@ truedirec(way, option)
                case WEST:
                        return ("ahead");
                }
-
-       default:
-               printf("Error: room %d.  More than four directions wanted.", position);
-               return ("!!");
+               break;
        }
+
+       printf("Error: room %d.  More than four directions wanted.", 
+           position);
+       return ("!!");
 }
 
 void
-newway(thisway)
-       int     thisway;
+newway(int thisway)
 {
        switch (direction) {