home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-04-11 | 2.4 KB | 90 lines | [TEXT/MMCC] |
- // game.h
-
- typedef enum {
- BeginningOfGame, MachinePlaysWhite, MachinePlaysBlack, TwoMachinesPlay,
- EditGame, PlayFromGameFile, EndOfGame, EditPosition,
- IcsIdle, IcsPlayingWhite, IcsPlayingBlack, IcsObserving,
- IcsExamining
- } GameMode;
-
- typedef enum {
- empty = 0, WhitePawn, WhiteKnight, WhiteBishop, WhiteRook, WhiteQueen, WhiteKing,
- BlackPawn, BlackKnight, BlackBishop, BlackRook, BlackQueen, BlackKing
- };
-
- #define RELATION_OBSERVING_PLAYED 0
- #define RELATION_OBSERVING_STATIC -2 /* examined, oldmoves, or smoves */
- #define RELATION_PLAYING_MYMOVE 1
- #define RELATION_PLAYING_NOTMYMOVE -1
- #define RELATION_EXAMINING 2
- #define RELATION_ISOLATED_BOARD -3
-
- typedef short Board[8][8];
-
- #define kWhite 0
- #define kBlack 1
-
- typedef short Cmove[2][2];
-
- enum {
- ctlForward = 0,
- ctlBack,
- ctlStart,
- ctlEnd,
- ctlRevert,
- kNumGameControls
- };
-
- // this is all the info for a particular game
- typedef struct Game {
- Game *next, *prev;
-
- CWindowPtr wind;
- ControlHandle ctl[kNumGameControls];
- Rect boardRect;
- short sqsize;
-
- Boolean jexiste;
- short relation; // our relation to the game -- see constants above
- char endReason[64];
- Board board;
- short origNumber, number; // official game number according to server
- char name[2][128];
- short turn;
- Boolean bug, footer, setup;
- short reserves[2][5];
-
- long ptime[2];
- ulong lTime;
- long gameMins, gameInc;
- char elapsed[16];
- long thinking;
-
- short strength[2];
- Boolean flip;
- Cmove lastMove;
- short officialMove;
- Point tempDest;
-
- char lmove[2][16];
-
- Boolean isFirst, isSecond;
-
- short p1OffsetY, bOffsetY, p2OffsetY;
- } Game;
-
- extern Game *gGames;
-
- void InitGame(void);
- void DrawGameWindow(void);
- void GameIdle(void);
- void StopPlaying(void);
- void StartPlaying(void);
- Game * NewGame(char *p1, char *p2, short gameNum, Boolean flip);
- void DisposeGame(Game *game);
- void CloseGameWindow(WindowPtr win);
- void DrawGameWindow(WindowPtr win);
- void DrawGame(Game *game);
- void DrawGameBoard(Game *game);
- void DrawGameStats(Game *game);
- void HandleGameClic