From 026158ce21511a76693e38921c011f2f2fa66002 Mon Sep 17 00:00:00 2001 From: christos Date: Thu, 31 Jan 2002 17:35:52 +0000 Subject: Be more verbose about teleports, and fix a minor problem in autobot mode. --- robots/auto.c | 4 ++-- robots/init_field.c | 17 +++++++++++++++-- robots/move.c | 8 ++++++-- robots/robots.h | 5 +++-- 4 files changed, 26 insertions(+), 8 deletions(-) diff --git a/robots/auto.c b/robots/auto.c index c0a15bf8..29bba259 100644 --- a/robots/auto.c +++ b/robots/auto.c @@ -1,4 +1,4 @@ -/* $NetBSD: auto.c,v 1.4 1999/09/08 21:17:56 jsm Exp $ */ +/* $NetBSD: auto.c,v 1.5 2002/01/31 17:35:52 christos Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -236,7 +236,7 @@ move_towards(dx, dy) (void)strcpy(ok_moves, find_moves()); best_move = ok_moves[0]; - if (best_move != 'F') { + if (best_move != 't') { mvx = xinc(best_move); mvy = yinc(best_move); move_judge = ABS(mvx - dx) + ABS(mvy - dy); diff --git a/robots/init_field.c b/robots/init_field.c index 57200a44..822ab10b 100644 --- a/robots/init_field.c +++ b/robots/init_field.c @@ -1,4 +1,4 @@ -/* $NetBSD: init_field.c,v 1.6 1999/09/08 21:17:57 jsm Exp $ */ +/* $NetBSD: init_field.c,v 1.7 2002/01/31 17:35:52 christos Exp $ */ /* * Copyright (c) 1980, 1993 @@ -38,12 +38,15 @@ #if 0 static char sccsid[] = "@(#)init_field.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: init_field.c,v 1.6 1999/09/08 21:17:57 jsm Exp $"); +__RCSID("$NetBSD: init_field.c,v 1.7 2002/01/31 17:35:52 christos Exp $"); #endif #endif /* not lint */ # include "robots.h" +static int telx = 0; +static int tely = 0; + /* * init_field: * Lay down the initial pattern whih is constant across all levels, @@ -112,6 +115,8 @@ init_field() move(i, X_FIELDSIZE + 2); addstr(desc[i]); } + telx = X_FIELDSIZE + 2; + tely = i; if (first) refresh(); first = FALSE; @@ -120,3 +125,11 @@ init_field() Next_move = &Move_list[-1]; #endif } + +void +telmsg(on) + int on; +{ + move(tely, telx); + addstr(on ? "Teleport!" : " "); +} diff --git a/robots/move.c b/robots/move.c index a74c6c76..c0982925 100644 --- a/robots/move.c +++ b/robots/move.c @@ -1,4 +1,4 @@ -/* $NetBSD: move.c,v 1.9 1999/09/08 21:17:57 jsm Exp $ */ +/* $NetBSD: move.c,v 1.10 2002/01/31 17:35:52 christos Exp $ */ /* * Copyright (c) 1980, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)move.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: move.c,v 1.9 1999/09/08 21:17:57 jsm Exp $"); +__RCSID("$NetBSD: move.c,v 1.10 2002/01/31 17:35:52 christos Exp $"); #endif #endif /* not lint */ @@ -175,6 +175,10 @@ teleport: Running = FALSE; mvaddch(My_pos.y, My_pos.x, ' '); My_pos = *rnd_pos(); + telmsg(1); + refresh(); + sleep(1); + telmsg(0); mvaddch(My_pos.y, My_pos.x, PLAYER); leaveok(stdscr, FALSE); refresh(); diff --git a/robots/robots.h b/robots/robots.h index 23a761ba..edd37a92 100644 --- a/robots/robots.h +++ b/robots/robots.h @@ -1,4 +1,4 @@ -/* $NetBSD: robots.h,v 1.14 1999/09/30 18:01:33 jsm Exp $ */ +/* $NetBSD: robots.h,v 1.15 2002/01/31 17:35:52 christos Exp $ */ /* * Copyright (c) 1980, 1993 @@ -125,6 +125,7 @@ extern jmp_buf End_move; void add_score __P((int)); bool another __P((void)); +char automove __P((void)); int cmp_sc __P((const void *, const void *)); bool do_move __P((int, int)); bool eaten __P((const COORD *)); @@ -145,4 +146,4 @@ void score __P((int)); void set_name __P((SCORE *)); void show_score __P((void)); int sign __P((int)); -char automove __P((void)); +void telmsg __P((int)); -- cgit v1.2.3-56-ge451