home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / games / volume2 / dots2 / dots.h < prev    next >
C/C++ Source or Header  |  1987-09-18  |  3KB  |  119 lines

  1. /*    dots.h    */
  2.  
  3. #include <curses.h>
  4. #include <sys/types.h>
  5. #include <sys/ioctl.h>
  6. #if defined(lint) && defined(BSD)
  7. #include <sys/uio.h>
  8. #endif /* lint && BSD */
  9. #ifdef BSD
  10. #include <sys/socket.h>
  11. #endif /* BSD */
  12. #include <ctype.h>
  13. #include <signal.h>
  14. #include <setjmp.h>
  15. #ifdef BSD
  16. #include <strings.h>
  17. #else
  18. #include <string.h>
  19. #endif /* BSD */
  20.  
  21. #ifdef BSD
  22. extern char *sprintf();
  23. #else
  24. extern int sprintf();
  25. #endif /* BSD */
  26.  
  27. /* Most BSD systems don't have vprintf, but sun versions 3.0 and up do have it.
  28.  * If you're system doesn't have it, comment out the define line. System-V
  29.  * systems do have it.
  30.  */
  31. #ifdef SYSV
  32. #define VPRINTF
  33. #endif /* SYSV */
  34.  
  35. #ifdef SYSV
  36. #define SIGCHLD SIGCLD
  37. #define srandom srand
  38. #define random rand
  39. #define index strchr
  40. #define rindex strrchr
  41. #endif /* SYSV */
  42.  
  43. #define PRIZE        "cigar"
  44. #define DOCFILE        "/usr/games/lib/dots/dots.doc"
  45. #define SAVE_FILE    "dots.save"
  46. #define SCOREFILE    "/usr/games/lib/dots/dots.scores" /* should be full pathname */
  47. #define version        "Dots version 2.0"
  48.  
  49. #define when        break;case
  50. #define otherwise    break;default
  51. #define Upper(c)    (c = islower(c) ? toupper(c) : c)
  52. #define Lower(c)    (c = isupper(c) ? tolower(c) : c)
  53. #define max(a,b)    ((a) > (b) ? (a) : (b))
  54. #define min(a,b)    ((a) > (b) ? (b) : (a))
  55. #define erase_char    '\b'
  56.  
  57. #define ESC        '\033'
  58. #define DEMO        0
  59. #define INTERACTIVE    1
  60. #define TWOPLAYER    2
  61. #define GOOD        0
  62. #define BAD        1
  63. #define DUMB        0
  64. #define HARD        1
  65. #define KILLER        2
  66. #define FREE        0
  67. #define USED        1
  68. #define CLOSEDEND    0  /* used for segtype for creating doublecrosses */
  69. #define OPENEND        1    /* ditto */
  70. #define MAXL        (COLS / 4)
  71. #define MAXW        (LINES / 2)
  72. #define H_MINL        10
  73. #define H_MINW        10
  74. #define MINL        4
  75. #define MINW        4
  76. #define US        0
  77. #define THEM        1
  78. #define SAVE        0
  79. #define LOAD        1
  80. #define isodd(a)    ((a)%2)
  81. #define iseven(a)    (!isodd(a))
  82. #define ism4(a)        (!((a)%4))
  83. #define do_twice    for(twicecount=1;twicecount<=2;++twicecount)
  84.  
  85. int
  86.     board[120][120],
  87.     badboard[120][120],
  88.     persontally, comptally,
  89.     Length, Width,
  90.     xposit, yposit,
  91.     x_start, y_start,
  92.     mover,        /* 0 is person/US, 1 is computer/THEM */
  93.     twicecount,
  94.     no_good_moves,
  95.     control_already_established,
  96.     segtype,    /* OPENEND or CLOSEDEND ; set everytime Howbad is called */
  97.     dX_found,
  98.     segflag,
  99.     mode,
  100.     level,
  101.     sd,            /* socket descriptor */
  102.     jmpbuf_set;
  103.  
  104. struct {
  105.     int x, y;
  106. }   Bingo;
  107.  
  108. struct tchars tchars;
  109.  
  110. char *opponent, prize[30], save_file[50], *getenv();
  111. char Initial[2], *username;
  112. int onintr(), redraw(), oops();
  113.  
  114. /* jump to the menu so there's no big stacks (supposedly) */
  115. jmp_buf menu_jmp;
  116.  
  117. extern int errno;
  118. extern char *sys_errlist[], *sys_siglist[];
  119.