sync with 44lite, seems to fix bug #224

This commit is contained in:
jtc 1994-05-12 17:39:26 +00:00
parent 98d2c75927
commit e833a90ed2
17 changed files with 120 additions and 138 deletions

View File

@ -1,11 +1,11 @@
# from: @(#)Makefile 5.10 (Berkeley) 5/11/90
# $Id: Makefile,v 1.2 1993/08/01 05:45:03 mycroft Exp $
# from: @(#)Makefile 8.1 (Berkeley) 5/31/93
# $Id: Makefile,v 1.3 1994/05/12 17:39:26 jtc Exp $
PROG= mille
SRCS= comp.c end.c extern.c init.c mille.c misc.c move.c print.c \
roll.c save.c types.c varpush.c
DPADD= ${LIBCURSES} ${LIBTERM}
LDADD= -lcurses -ltermlib
DPADD= ${LIBCURSES} ${LIBTERM} ${LIBCOMPAT}
LDADD= -lcurses -ltermlib -lcompat
MAN6= mille.0
HIDEGAME=hidegame

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 1982 Regents of the University of California.
* All rights reserved.
* Copyright (c) 1982, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -32,8 +32,8 @@
*/
#ifndef lint
/*static char sccsid[] = "from: @(#)comp.c 5.4 (Berkeley) 6/1/90";*/
static char rcsid[] = "$Id: comp.c,v 1.2 1993/08/01 18:54:05 mycroft Exp $";
/*static char sccsid[] = "from: @(#)comp.c 8.1 (Berkeley) 5/31/93";*/
static char rcsid[] = "$Id: comp.c,v 1.3 1994/05/12 17:39:27 jtc Exp $";
#endif /* not lint */
# include "mille.h"
@ -64,6 +64,8 @@ calcmove()
cango = 0;
canstop = FALSE;
foundend = FALSE;
/* Try for a Coup Forre, and see what we have. */
for (i = 0; i < NUM_CARDS; i++)
count[i] = 0;
for (i = 0; i < HAND_SZ; i++) {
@ -104,12 +106,16 @@ norm:
playit[i] = TRUE;
break;
}
++count[card];
if (card >= 0)
++count[card];
}
/* No Coup Forre. Draw to fill hand, then restart, as needed. */
if (pp->hand[0] == C_INIT && Topcard > Deck) {
Movetype = M_DRAW;
return;
}
#ifdef DEBUG
if (Debug)
fprintf(outf, "CALCMOVE: cango = %d, canstop = %d, safe = %d\n",
@ -375,16 +381,8 @@ normbad:
if (cango) {
play_it:
mvaddstr(MOVE_Y + 1, MOVE_X, "PLAY\n");
#ifdef DEBUG
if (Debug)
getmove();
if (!Debug || Movetype == M_DRAW) {
#else
if (Movetype == M_DRAW) {
#endif
Movetype = M_PLAY;
Card_no = nummax;
}
Movetype = M_PLAY;
Card_no = nummax;
}
else {
if (issafety(pp->hand[nummin])) { /* NEVER discard a safety */
@ -392,20 +390,15 @@ play_it:
goto play_it;
}
mvaddstr(MOVE_Y + 1, MOVE_X, "DISCARD\n");
#ifdef DEBUG
if (Debug)
getmove();
if (!Debug || Movetype == M_DRAW) {
#else
if (Movetype == M_DRAW) {
#endif
Movetype = M_DISCARD;
Card_no = nummin;
}
Movetype = M_DISCARD;
Card_no = nummin;
}
mvprintw(MOVE_Y + 2, MOVE_X, "%16s", C_name[pp->hand[Card_no]]);
}
/*
* Return true if the given player could conceivably win with his next card.
*/
onecard(pp)
register PLAY *pp;
{
@ -416,7 +409,7 @@ register PLAY *pp;
card = -1;
if (pp->can_go || ((isrepair(bat) || bat == C_STOP || spd == C_LIMIT) &&
Numseen[S_RIGHT_WAY] != 0) ||
Numseen[safety(bat)] != 0)
bat >= 0 && Numseen[safety(bat)] != 0)
switch (End - pp->mileage) {
case 200:
if (pp->nummiles[C_200] == 2)

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 1982 Regents of the University of California.
* All rights reserved.
* Copyright (c) 1982, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -32,8 +32,8 @@
*/
#ifndef lint
/*static char sccsid[] = "from: @(#)end.c 5.4 (Berkeley) 6/1/90";*/
static char rcsid[] = "$Id: end.c,v 1.2 1993/08/01 18:54:04 mycroft Exp $";
/*static char sccsid[] = "from: @(#)end.c 8.1 (Berkeley) 5/31/93";*/
static char rcsid[] = "$Id: end.c,v 1.3 1994/05/12 17:39:29 jtc Exp $";
#endif /* not lint */
# include "mille.h"

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 1982 Regents of the University of California.
* All rights reserved.
* Copyright (c) 1982, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -32,8 +32,8 @@
*/
#ifndef lint
/*static char sccsid[] = "from: @(#)extern.c 5.5 (Berkeley) 6/1/90";*/
static char rcsid[] = "$Id: extern.c,v 1.2 1993/08/01 18:54:03 mycroft Exp $";
/*static char sccsid[] = "from: @(#)extern.c 8.1 (Berkeley) 5/31/93";*/
static char rcsid[] = "$Id: extern.c,v 1.3 1994/05/12 17:39:30 jtc Exp $";
#endif /* not lint */
# include "mille.h"

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 1982 Regents of the University of California.
* All rights reserved.
* Copyright (c) 1982, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -32,8 +32,8 @@
*/
#ifndef lint
/*static char sccsid[] = "from: @(#)init.c 5.4 (Berkeley) 6/1/90";*/
static char rcsid[] = "$Id: init.c,v 1.3 1994/01/13 01:19:58 mycroft Exp $";
/*static char sccsid[] = "from: @(#)init.c 8.1 (Berkeley) 5/31/93";*/
static char rcsid[] = "$Id: init.c,v 1.4 1994/05/12 17:39:31 jtc Exp $";
#endif /* not lint */
# include "mille.h"
@ -94,7 +94,7 @@ shuffle() {
r = roll(1, DECK_SZ) - 1;
if (r < 0 || r > DECK_SZ - 1) {
fprintf(stderr, "shuffle: card no. error: %d\n", r);
die();
die(1);
}
temp = Deck[r];
Deck[r] = Deck[i];
@ -185,8 +185,7 @@ newscore() {
mvaddstr(4, 37, "300");
new = TRUE;
}
else if (((Window == W_FULL || Finished) ^ was_full) ||
pp->was_finished != Finished) {
else if ((Window == W_FULL || Finished) ^ was_full) {
move(5, 1);
clrtobot();
new = TRUE;
@ -197,7 +196,7 @@ newscore() {
for (i = 0; i < SCORE_Y; i++)
mvaddch(i, 0, '|');
move(SCORE_Y - 1, 1);
for (i = 0; i < SCORE_X - 1; i++)
for (i = 0; i < SCORE_X; i++)
addch('_');
for (pp = Player; pp <= &Player[COMP]; pp++) {
pp->sh_hand_tot = -1;

View File

@ -1,5 +1,5 @@
.\" Copyright (c) 1983 The Regents of the University of California.
.\" All rights reserved.
.\" Copyright (c) 1983, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
@ -29,20 +29,20 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" from: @(#)mille.6 6.4 (Berkeley) 6/23/90
.\" $Id: mille.6,v 1.2 1993/08/01 07:46:43 mycroft Exp $
.\" from: @(#)mille.6 8.2 (Berkeley) 12/30/93
.\" $Id: mille.6,v 1.3 1994/05/12 17:39:32 jtc Exp $
.\"
.TH MILLE 6 "June 23, 1990"
.TH MILLE 6 "December 30, 1993"
.UC 4
.SH NAME
mille \- play Mille Bournes
mille \- play Mille Bornes
.SH SYNOPSIS
.B /usr/games/mille
[ file ]
.SH DESCRIPTION
.I Mille
plays a two-handed game reminiscent of
the Parker Brother's game of Mille Bournes with you.
the Parker Brother's game of Mille Bornes with you.
The rules are described below.
If a file name is given on the command line,
the game saved in that file is started.
@ -325,8 +325,9 @@ If the trip is completed after the deck runs out, this is called
.PP
.BR "Coup Fourr\o'\(aae'" :
This is a French fencing term for a counter-thrust move as part of a parry
to an opponents attack.
In Mille Bournes, it is used as follows:
to an opponent's attack.
In current French colloquial language it means a sneaky, underhanded blow.
In Mille Bornes, it is used as follows:
If an opponent plays a Hazard card,
and you have the corresponding Safety in your hand,
you play it immediately, even
@ -349,8 +350,8 @@ Each player scores as many miles as they played before the trip ended.
.RB "\ \ \ \ " "All 4 Safeties" :
300 points if all four safeties are played.
.br
.RB "\ \ \ \ " "Each Coup Four\o'\(aae'" :
300 points for each Coup Four\o'\(aae' accomplished.
.RB "\ \ \ \ " "Each Coup Fourr\o'\(aae'" :
300 points for each Coup Fourr\o'\(aae' accomplished.
.PP
The following bonus scores can apply only to the winning player.
.br

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 1982 Regents of the University of California.
* All rights reserved.
* Copyright (c) 1982, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -32,14 +32,14 @@
*/
#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1982 Regents of the University of California.\n\
All rights reserved.\n";
static char copyright[] =
"@(#) Copyright (c) 1982, 1993\n\
The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */
#ifndef lint
/*static char sccsid[] = "from: @(#)mille.c 5.5 (Berkeley) 2/28/91";*/
static char rcsid[] = "$Id: mille.c,v 1.2 1993/08/01 18:54:01 mycroft Exp $";
/*static char sccsid[] = "from: @(#)mille.c 8.1 (Berkeley) 5/31/93";*/
static char rcsid[] = "$Id: mille.c,v 1.3 1994/05/12 17:39:33 jtc Exp $";
#endif /* not lint */
# include "mille.h"
@ -82,13 +82,6 @@ reg char *av[]; {
}
Play = PLAYER;
initscr();
# ifdef attron
# define CA cursor_address
# endif
if (!CA) {
printf("Sorry. Need cursor addressing to play mille\n");
exit(-1);
}
delwin(stdscr);
stdscr = Board = newwin(BOARD_Y, BOARD_X, 0, 0);
Score = newwin(SCORE_Y, SCORE_X, 0, 40);
@ -152,20 +145,20 @@ rub() {
(void)signal(SIGINT, SIG_IGN);
if (getyn(REALLYPROMPT))
die();
die(0);
(void)signal(SIGINT, rub);
}
/*
* Time to go beddy-by
*/
die() {
die(code)
int code; {
(void)signal(SIGINT, SIG_IGN);
if (outf)
fflush(outf);
mvcur(0, COLS - 1, LINES - 1, 0);
endwin();
exit(1);
exit(code);
}

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 1982 Regents of the University of California.
* All rights reserved.
* Copyright (c) 1982, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -30,8 +30,8 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)mille.h 5.5 (Berkeley) 6/1/90
* $Id: mille.h,v 1.3 1993/08/10 02:48:47 mycroft Exp $
* from: @(#)mille.h 8.1 (Berkeley) 5/31/93
* $Id: mille.h,v 1.4 1994/05/12 17:39:34 jtc Exp $
*/
# include <sys/types.h>

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 1983 Regents of the University of California.
* All rights reserved.
* Copyright (c) 1983, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -32,16 +32,18 @@
*/
#ifndef lint
/*static char sccsid[] = "from: @(#)misc.c 5.6 (Berkeley) 6/1/90";*/
static char rcsid[] = "$Id: misc.c,v 1.2 1993/08/01 18:53:59 mycroft Exp $";
/*static char sccsid[] = "from: @(#)misc.c 8.1 (Berkeley) 5/31/93";*/
static char rcsid[] = "$Id: misc.c,v 1.3 1994/05/12 17:39:35 jtc Exp $";
#endif /* not lint */
#include <sys/file.h>
#include <termios.h>
#include "mille.h"
#ifndef unctrl
#include "unctrl.h"
#endif
# include <sys/file.h>
# ifdef attron
# include <term.h>
@ -197,6 +199,9 @@ register int promptno; {
refresh();
Saved = save();
continue;
case CTRL('L'):
wrefresh(curscr);
break;
default:
addstr(unctrl(c));
refresh();
@ -213,8 +218,6 @@ register int promptno; {
*/
check_more() {
flush_input();
On_exit = TRUE;
if (Player[PLAYER].total >= 5000 || Player[COMP].total >= 5000)
if (getyn(ANOTHERGAMEPROMPT))
@ -236,7 +239,7 @@ check_more() {
if (!Saved && getyn(SAVEGAMEPROMPT))
if (!save())
return;
die();
die(0);
}
readch()
@ -249,14 +252,3 @@ readch()
exit(1);
return c;
}
flush_input()
{
# ifdef TIOCFLUSH
static int ioctl_args = O_RDONLY;
(void) ioctl(fileno(stdin), TIOCFLUSH, &ioctl_args);
# else
fflush(stdin);
# endif
}

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 1983 Regents of the University of California.
* All rights reserved.
* Copyright (c) 1983, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -32,10 +32,12 @@
*/
#ifndef lint
/*static char sccsid[] = "from: @(#)move.c 5.4 (Berkeley) 6/1/90";*/
static char rcsid[] = "$Id: move.c,v 1.2 1993/08/01 18:53:58 mycroft Exp $";
/*static char sccsid[] = "from: @(#)move.c 8.1 (Berkeley) 5/31/93";*/
static char rcsid[] = "$Id: move.c,v 1.3 1994/05/12 17:39:37 jtc Exp $";
#endif /* not lint */
#include <termios.h>
#include "mille.h"
#ifndef unctrl
#include "unctrl.h"

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 1982 Regents of the University of California.
* All rights reserved.
* Copyright (c) 1982, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -32,8 +32,8 @@
*/
#ifndef lint
/*static char sccsid[] = "from: @(#)print.c 5.4 (Berkeley) 6/1/90";*/
static char rcsid[] = "$Id: print.c,v 1.2 1993/08/01 18:53:57 mycroft Exp $";
/*static char sccsid[] = "from: @(#)print.c 8.1 (Berkeley) 5/31/93";*/
static char rcsid[] = "$Id: print.c,v 1.3 1994/05/12 17:39:39 jtc Exp $";
#endif /* not lint */
# include "mille.h"

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 1982 Regents of the University of California.
* All rights reserved.
* Copyright (c) 1982, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -32,8 +32,8 @@
*/
#ifndef lint
/*static char sccsid[] = "from: @(#)roll.c 5.4 (Berkeley) 6/1/90";*/
static char rcsid[] = "$Id: roll.c,v 1.2 1993/08/01 18:53:57 mycroft Exp $";
/*static char sccsid[] = "from: @(#)roll.c 8.1 (Berkeley) 5/31/93";*/
static char rcsid[] = "$Id: roll.c,v 1.3 1994/05/12 17:39:40 jtc Exp $";
#endif /* not lint */
# include "mille.h"

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 1983 Regents of the University of California.
* All rights reserved.
* Copyright (c) 1983, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -32,16 +32,18 @@
*/
#ifndef lint
/*static char sccsid[] = "from: @(#)save.c 5.6 (Berkeley) 6/1/90";*/
static char rcsid[] = "$Id: save.c,v 1.2 1993/08/01 18:53:56 mycroft Exp $";
/*static char sccsid[] = "from: @(#)save.c 8.1 (Berkeley) 5/31/93";*/
static char rcsid[] = "$Id: save.c,v 1.3 1994/05/12 17:39:41 jtc Exp $";
#endif /* not lint */
#include "mille.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <termios.h>
#include "mille.h"
#ifndef unctrl
#include "unctrl.h"
#include "unctrl.h"
#endif
# ifdef attron

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 1982 Regents of the University of California.
* All rights reserved.
* Copyright (c) 1982, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -32,14 +32,14 @@
*/
#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1982 Regents of the University of California.\n\
All rights reserved.\n";
static char copyright[] =
"@(#) Copyright (c) 1982, 1993\n\
The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */
#ifndef lint
/*static char sccsid[] = "from: @(#)table.c 5.4 (Berkeley) 6/1/90";*/
static char rcsid[] = "$Id: table.c,v 1.2 1993/08/01 18:53:55 mycroft Exp $";
/*static char sccsid[] = "from: @(#)table.c 8.1 (Berkeley) 5/31/93";*/
static char rcsid[] = "$Id: table.c,v 1.3 1994/05/12 17:39:42 jtc Exp $";
#endif /* not lint */
# define DEBUG

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 1982 Regents of the University of California.
* All rights reserved.
* Copyright (c) 1982, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -32,8 +32,8 @@
*/
#ifndef lint
/*static char sccsid[] = "from: @(#)types.c 5.4 (Berkeley) 6/1/90";*/
static char rcsid[] = "$Id: types.c,v 1.2 1993/08/01 18:53:54 mycroft Exp $";
/*static char sccsid[] = "from: @(#)types.c 8.1 (Berkeley) 5/31/93";*/
static char rcsid[] = "$Id: types.c,v 1.3 1994/05/12 17:39:43 jtc Exp $";
#endif /* not lint */
# include "mille.h"

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 1982 Regents of the University of California.
* All rights reserved.
* Copyright (c) 1982, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -30,8 +30,8 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)unctrl.h 5.4 (Berkeley) 6/1/90
* $Id: unctrl.h,v 1.2 1993/08/01 18:54:06 mycroft Exp $
* from: @(#)unctrl.h 8.1 (Berkeley) 5/31/93
* $Id: unctrl.h,v 1.3 1994/05/12 17:39:44 jtc Exp $
*/
/*

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 1982 Regents of the University of California.
* All rights reserved.
* Copyright (c) 1982, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -32,8 +32,8 @@
*/
#ifndef lint
/*static char sccsid[] = "from: @(#)varpush.c 5.6 (Berkeley) 6/1/90";*/
static char rcsid[] = "$Id: varpush.c,v 1.2 1993/08/01 18:53:52 mycroft Exp $";
/*static char sccsid[] = "from: @(#)varpush.c 8.1 (Berkeley) 5/31/93";*/
static char rcsid[] = "$Id: varpush.c,v 1.3 1994/05/12 17:39:45 jtc Exp $";
#endif /* not lint */
# include <paths.h>