]> git.cameronkatri.com Git - bsdgames-darwin.git/blobdiff - robots/move.c
No argument for .Os.
[bsdgames-darwin.git] / robots / move.c
index c146eb3dc34a165a369c84cebf8dc731c0a70aa3..a74c6c768ef2e3078ecfc67121764bd164d87c07 100644 (file)
@@ -1,4 +1,4 @@
-/*     $NetBSD: move.c,v 1.5 1997/05/23 23:40:19 jtc Exp $     */
+/*     $NetBSD: move.c,v 1.9 1999/09/08 21:17:57 jsm Exp $     */
 
 /*
  * Copyright (c) 1980, 1993
  * SUCH DAMAGE.
  */
 
+#include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)move.c     8.1 (Berkeley) 5/31/93";
 #else
-static char rcsid[] = "$NetBSD: move.c,v 1.5 1997/05/23 23:40:19 jtc Exp $";
+__RCSID("$NetBSD: move.c,v 1.9 1999/09/08 21:17:57 jsm Exp $");
 #endif
 #endif /* not lint */
 
-#include <sys/ttydefaults.h>
-#include <ctype.h>
 #include "robots.h"
 
 # define       ESC     '\033'
@@ -51,11 +50,13 @@ static char rcsid[] = "$NetBSD: move.c,v 1.5 1997/05/23 23:40:19 jtc Exp $";
  * get_move:
  *     Get and execute a move from the player
  */
+void
 get_move()
 {
-       register int    c;
-       register int    y, x, lastmove;
-       static COORD    newpos;
+       int             c;
+#ifdef FANCY
+       int             lastmove;
+#endif /*FANCY*/
 
        if (Waiting)
                return;
@@ -66,7 +67,8 @@ get_move()
                        lastmove = *Next_move;
                else
                        lastmove = -1;  /* flag for "first time in" */
-       }
+       } else
+               lastmove = 0; /* Shut up gcc */
 #endif
        for (;;) {
                if (Teleport && must_telep())
@@ -92,7 +94,10 @@ get_move()
 #endif
                else {
 over:
-                       c = getchar();
+                       if (Auto_bot)
+                               c = automove();
+                       else
+                               c = getchar();
                        if (isdigit(c)) {
                                Count = (c - '0');
                                while (isdigit(c = getchar()))
@@ -156,7 +161,7 @@ over:
                  case 'q':
                  case 'Q':
                        if (query("Really quit?"))
-                               quit();
+                               quit(0);
                        refresh();
                        break;
                  case 'w':
@@ -198,9 +203,10 @@ ret:
  *     Must I teleport; i.e., is there anywhere I can move without
  * being eaten?
  */
+bool
 must_telep()
 {
-       register int    x, y;
+       int             x, y;
        static COORD    newpos;
 
 #ifdef FANCY
@@ -229,8 +235,9 @@ must_telep()
  * do_move:
  *     Execute a move
  */
+bool
 do_move(dy, dx)
-int    dy, dx;
+       int     dy, dx;
 {
        static COORD    newpos;
 
@@ -265,10 +272,11 @@ int       dy, dx;
  * eaten:
  *     Player would get eaten at this place
  */
+bool
 eaten(pos)
-register COORD *pos;
+       const COORD     *pos;
 {
-       register int    x, y;
+       int     x, y;
 
        for (y = pos->y - 1; y <= pos->y + 1; y++) {
                if (y <= 0 || y >= Y_FIELDSIZE)
@@ -287,6 +295,7 @@ register COORD      *pos;
  * reset_count:
  *     Reset the count variables
  */
+void
 reset_count()
 {
        Count = 0;
@@ -299,6 +308,7 @@ reset_count()
  * jumping:
  *     See if we are jumping, i.e., we should not refresh.
  */
+bool
 jumping()
 {
        return (Jump && (Count || Running || Waiting));