summaryrefslogtreecommitdiff
path: root/games/backgammon/common_source/check.c
diff options
context:
space:
mode:
authorPaul Janzen <pjanzen@cvs.openbsd.org>2001-06-23 23:50:07 +0000
committerPaul Janzen <pjanzen@cvs.openbsd.org>2001-06-23 23:50:07 +0000
commit4b888f757520208f6eb16c642891507450aea872 (patch)
tree88ad863f2489148ec58400d846f1b340b0fc7de3 /games/backgammon/common_source/check.c
parent0ffd7e0316588c2558ff550c5d0e25f5a8b2ea65 (diff)
termios -> curses
Diffstat (limited to 'games/backgammon/common_source/check.c')
-rw-r--r--games/backgammon/common_source/check.c58
1 files changed, 18 insertions, 40 deletions
diff --git a/games/backgammon/common_source/check.c b/games/backgammon/common_source/check.c
index a5bec6c6396..164c348d7c0 100644
--- a/games/backgammon/common_source/check.c
+++ b/games/backgammon/common_source/check.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: check.c,v 1.3 1999/07/31 21:57:40 pjanzen Exp $ */
+/* $OpenBSD: check.c,v 1.4 2001/06/23 23:50:03 pjanzen Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)check.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$OpenBSD: check.c,v 1.3 1999/07/31 21:57:40 pjanzen Exp $";
+static char rcsid[] = "$OpenBSD: check.c,v 1.4 2001/06/23 23:50:03 pjanzen Exp $";
#endif
#endif /* not lint */
@@ -55,41 +55,26 @@ getmove()
switch (i) {
case -1:
if (movokay(mvlim)) {
- if (tflag)
- curmove(20, 0);
- else
- writec('\n');
+ move(20, 0);
for (i = 0; i < mvlim; i++)
if (h[i])
wrhit(g[i]);
nexturn();
if (*offopp == 15)
cturn *= -2;
- if (tflag && pnum)
- bflag = pnum;
return;
}
case -4:
case 0:
- if (tflag)
- refresh();
+ refresh();
if (i != 0 && i != -4)
break;
- if (tflag)
- curmove(20, 0);
- else
- writec('\n');
- writel(*Colorptr);
+ mvaddstr(20, 0, *Colorptr);
if (i == -4)
- writel(" must make ");
+ addstr(" must make ");
else
- writel(" can only make ");
- writec(mvlim + '0');
- writel(" move");
- if (mvlim > 1)
- writec('s');
- writec('.');
- writec('\n');
+ addstr(" can only make ");
+ printw("%d move%s.\n", mvlim, mvlim > 1 ? "s":"");
break;
case -3:
@@ -97,13 +82,9 @@ getmove()
return;
}
- if (!tflag)
- proll();
- else {
- curmove(cturn == -1 ? 18 : 19, 39);
- cline();
- c = -1;
- }
+ move(cturn == -1 ? 18 : 19, 39);
+ clrtoeol();
+ c = -1;
}
}
@@ -119,39 +100,36 @@ movokay(mv)
for (i = 0; i < mv; i++) {
if (p[i] == g[i]) {
moverr(i);
- curmove(20, 0);
- writel("Attempt to move to same location.\n");
+ mvaddstr(20, 0, "Attempt to move to same location.\n");
return(0);
}
if (cturn * (g[i] - p[i]) < 0) {
moverr(i);
- curmove(20, 0);
- writel("Backwards move.\n");
+ mvaddstr(20, 0, "Backwards move.\n");
return(0);
}
if (abs(board[bar]) && p[i] != bar) {
moverr(i);
- curmove(20, 0);
- writel("Men still on bar.\n");
+ mvaddstr(20, 0, "Men still on bar.\n");
return(0);
}
if ((m = makmove(i))) {
moverr(i);
switch (m) {
case 1:
- writel("Move not rolled.\n");
+ addstr("Move not rolled.\n");
break;
case 2:
- writel("Bad starting position.\n");
+ addstr("Bad starting position.\n");
break;
case 3:
- writel("Destination occupied.\n");
+ addstr("Destination occupied.\n");
break;
case 4:
- writel("Can't remove men yet.\n");
+ addstr("Can't remove men yet.\n");
}
return(0);
}