home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Entertainment / Concentration / Main.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-25  |  1.6 KB  |  95 lines  |  [TEXT/KAHL]

  1. /*
  2.  * Concentation release 1.00
  3.  *
  4.  * 29 Jan 87    Paul DuBois
  5.  *
  6.  * 29 Jan 87 Release 1.00
  7.  * - Created
  8.  * 12 Dec 93
  9.  * - Updated for TransSkel 3.05, THINK C 6.0.1.
  10.  * - Prototyped the source code.
  11.  * - Added check for insufficent number of pieces for board size.
  12.  * 22 Feb 94
  13.  * - Updated for TransSkel 3.11, Blob Manager 1.07.
  14.  *
  15.  * Do:
  16.  *     don't need to assign the reference constant until a new
  17.  *     game is begun.  That will allow all pieces to be brought
  18.  *     in sooner or later.
  19.  */
  20.  
  21. # include    <GestaltEqu.h>
  22.  
  23. # include    "TransSkel.h"
  24. # include    "Message.h"
  25. # if ENABLE_DEBUG
  26. # include    "Debug.h"
  27. # endif ENABLE_DEBUG
  28.  
  29. # include    "Concentration.h"
  30.  
  31.  
  32. # define    bailString    "\pConcentration"
  33.  
  34.  
  35. static void    Terminate (void);
  36.  
  37.  
  38. static ScoreBoard    scoreBoard =
  39. {
  40.     {                        /* initial player names */
  41.         "\pPlayer 1",
  42.         "\pPlayer 2",
  43.         "\pPlayer 3",
  44.         "\pPlayer 4"
  45.     },
  46.     { 0, 0, 0, 0 },            /* initial scores */
  47.     2,                        /* start with 2 players */
  48.     0,                        /* current player */
  49.     0                        /* initial first player */
  50. };
  51.  
  52. ScoreBoard    *sb = &scoreBoard;
  53.  
  54.  
  55. int
  56. main (void)
  57. {
  58.     SkelInit ((SkelInitParamsPtr) nil);
  59.     randSeed = TickCount ();
  60.  
  61.     SetMessageAlertNum (msgeAlrtNum);
  62.  
  63. # if ENABLE_DEBUG
  64.     SetupDebugWindow ();
  65.     ShowDebugWindow ();
  66. # endif
  67.  
  68.     SetupMenus ();
  69.     ReadPieces ();
  70.     WindInit ();
  71.     SkelEventLoop ();                /* loop 'til Quit selected */
  72.     DisposeBlobSets ();                /* shut down the Blob Manager */
  73.     SkelCleanup ();                    /* and TransSkel */
  74. }
  75.  
  76.  
  77. /*
  78.  * Termination routine
  79.  */
  80.  
  81. static void
  82. Terminate (void)
  83. {
  84.     SkelCleanup ();
  85.     ExitToShell ();
  86. }
  87.  
  88.  
  89. void
  90. Bail (StringPtr msg)
  91. {
  92.     Message4 (bailString, "\p: ", msg, "\p  Bailing out.");
  93.     Terminate ();
  94. }
  95.