#include "mille.h" # ifdef attron # include # define _tty cur_term->Nttyb # endif /* * @(#)misc.c 1.3 (Berkeley) 7/2/83 */ #define NUMSAFE 4 /* VARARGS1 */ error(str, arg) char *str; { Error (str, arg); Beep (); update_ui (); return FALSE; } check_ext(forcomp) reg bool forcomp; { if (End == 700) if (Play == PLAYER) { if (getyn("Extension? ")) { extend: if (!forcomp) End = 1000; return TRUE; } else { done: if (!forcomp) Finished = TRUE; return FALSE; } } else { reg PLAY *pp, *op; reg int i, safe, miles; pp = &Player[COMP]; op = &Player[PLAYER]; for (safe = 0, i = 0; i < NUMSAFE; i++) if (pp->safety[i] != S_UNKNOWN) safe++; if (safe < 2) goto done; if (op->mileage == 0 || onecard(op) || (op->can_go && op->mileage >= 500)) goto done; for (miles = 0, i = 0; i < NUMSAFE; i++) if (op->safety[i] != S_PLAYED && pp->safety[i] == S_UNKNOWN) miles++; if (miles + safe == NUMSAFE) goto extend; for (miles = 0, i = 0; i < HAND_SZ; i++) if ((safe = pp->hand[i]) <= C_200) miles += Value[safe]; if (miles + (Topcard - Deck) * 3 > 1000) goto extend; goto done; } else goto done; } /* * Check to see if more games are desired. If not, and game * came from a saved file, make sure that they don't want to restore * it. Exit appropriately. */ check_more() { FlushInput (); On_exit = TRUE; if (Player[PLAYER].total >= 5000 || Player[COMP].total >= 5000) if (getyn("Another game? ")) return; else { /* * must do accounting normally done in main() */ if (Player[PLAYER].total > Player[COMP].total) Player[PLAYER].games++; else if (Player[PLAYER].total < Player[COMP].total) Player[COMP].games++; Player[COMP].total = 0; Player[PLAYER].total = 0; } else if (getyn("Another hand? ")) return; if (!Saved && getyn("Save game? ")) if (!save()) return; die(); }