mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-27 09:58:45 +01:00
Remove all tabs. No code changes.
This commit is contained in:
parent
2dceb054b8
commit
e60d338488
35 changed files with 221 additions and 229 deletions
|
@ -51,12 +51,12 @@
|
||||||
#include "scorebdp.h"
|
#include "scorebdp.h"
|
||||||
#include "game.h"
|
#include "game.h"
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
#include "comms.h" /* for CHANNEL_NONE */
|
#include "comms.h" /* for CHANNEL_NONE */
|
||||||
#include "dictnry.h"
|
#include "dictnry.h"
|
||||||
#include "draw.h"
|
#include "draw.h"
|
||||||
#include "engine.h"
|
#include "engine.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "mempool.h" /* debug only */
|
#include "mempool.h" /* debug only */
|
||||||
#include "memstream.h"
|
#include "memstream.h"
|
||||||
#include "strutils.h"
|
#include "strutils.h"
|
||||||
#include "LocalizedStrIncludes.h"
|
#include "LocalizedStrIncludes.h"
|
||||||
|
@ -149,7 +149,7 @@ board_make( MPFORMAL ModelCtxt* model, ServerCtxt* server, DrawCtx* draw,
|
||||||
XP_ASSERT( !!model );
|
XP_ASSERT( !!model );
|
||||||
|
|
||||||
if ( result != NULL ) {
|
if ( result != NULL ) {
|
||||||
|
|
||||||
XP_MEMSET( result, 0, sizeof( *result ) );
|
XP_MEMSET( result, 0, sizeof( *result ) );
|
||||||
|
|
||||||
MPASSIGN(result->mpool, mpool);
|
MPASSIGN(result->mpool, mpool);
|
||||||
|
@ -359,8 +359,8 @@ board_setPos( BoardCtxt* board, XP_U16 left, XP_U16 top,
|
||||||
|
|
||||||
void
|
void
|
||||||
board_setTimerLoc( BoardCtxt* board,
|
board_setTimerLoc( BoardCtxt* board,
|
||||||
XP_U16 timerLeft, XP_U16 timerTop,
|
XP_U16 timerLeft, XP_U16 timerTop,
|
||||||
XP_U16 timerWidth, XP_U16 timerHeight )
|
XP_U16 timerWidth, XP_U16 timerHeight )
|
||||||
{
|
{
|
||||||
board->timerBounds.left = timerLeft;
|
board->timerBounds.left = timerLeft;
|
||||||
board->timerBounds.top = timerTop;
|
board->timerBounds.top = timerTop;
|
||||||
|
@ -576,8 +576,8 @@ board_commitTurn( BoardCtxt* board )
|
||||||
}
|
}
|
||||||
} else if ( checkRevealTray( board ) ) {
|
} else if ( checkRevealTray( board ) ) {
|
||||||
if ( board->tradeInProgress[turn] ) {
|
if ( board->tradeInProgress[turn] ) {
|
||||||
result = XP_TRUE; /* there's at least the window to clean up
|
result = XP_TRUE; /* there's at least the window to clean up
|
||||||
after */
|
after */
|
||||||
|
|
||||||
invalSelTradeWindow( board );
|
invalSelTradeWindow( board );
|
||||||
board->tradeInProgress[turn] = XP_FALSE;
|
board->tradeInProgress[turn] = XP_FALSE;
|
||||||
|
@ -586,7 +586,7 @@ board_commitTurn( BoardCtxt* board )
|
||||||
(XWStreamCtxt*)NULL ) ) {
|
(XWStreamCtxt*)NULL ) ) {
|
||||||
result = server_commitTrade( board->server,
|
result = server_commitTrade( board->server,
|
||||||
board->traySelBits[turn] );
|
board->traySelBits[turn] );
|
||||||
/* XP_DEBUGF( "server_commitTrade returned %d\n", result ); */
|
/* XP_DEBUGF( "server_commitTrade returned %d\n", result ); */
|
||||||
}
|
}
|
||||||
board->traySelBits[turn] = 0x00;
|
board->traySelBits[turn] = 0x00;
|
||||||
} else {
|
} else {
|
||||||
|
@ -699,7 +699,7 @@ selectPlayerImpl( BoardCtxt* board, XP_U16 newPlayer, XP_Bool reveal )
|
||||||
|
|
||||||
setTrayVisState( board, TRAY_REVERSED );
|
setTrayVisState( board, TRAY_REVERSED );
|
||||||
}
|
}
|
||||||
board->scoreBoardInvalid = XP_TRUE; /* if only one player, number of
|
board->scoreBoardInvalid = XP_TRUE; /* if only one player, number of
|
||||||
tiles remaining may have changed*/
|
tiles remaining may have changed*/
|
||||||
} /* selectPlayerImpl */
|
} /* selectPlayerImpl */
|
||||||
|
|
||||||
|
@ -1244,8 +1244,8 @@ drawBoard( BoardCtxt* board )
|
||||||
BlankQueue bq;
|
BlankQueue bq;
|
||||||
XP_Rect arrowRect;
|
XP_Rect arrowRect;
|
||||||
|
|
||||||
scrollIfCan( board ); /* this must happen before we count blanks
|
scrollIfCan( board ); /* this must happen before we count blanks
|
||||||
since it invalidates squares */
|
since it invalidates squares */
|
||||||
|
|
||||||
/* This is freaking expensive!!!! PENDING FIXME Can't we start from
|
/* This is freaking expensive!!!! PENDING FIXME Can't we start from
|
||||||
what's invalid rather than scanning the entire model every time
|
what's invalid rather than scanning the entire model every time
|
||||||
|
@ -1466,7 +1466,7 @@ chooseBestSelPlayer( BoardCtxt* board )
|
||||||
|
|
||||||
for ( i = 0; i < nPlayers; ++i ) {
|
for ( i = 0; i < nPlayers; ++i ) {
|
||||||
LocalPlayer* lp = &board->gi->players[curTurn];
|
LocalPlayer* lp = &board->gi->players[curTurn];
|
||||||
|
|
||||||
if ( !lp->isRobot && lp->isLocal ) {
|
if ( !lp->isRobot && lp->isLocal ) {
|
||||||
return curTurn;
|
return curTurn;
|
||||||
}
|
}
|
||||||
|
@ -1670,7 +1670,7 @@ board_requestHint( BoardCtxt* board,
|
||||||
XP_Bool searchComplete = XP_TRUE;
|
XP_Bool searchComplete = XP_TRUE;
|
||||||
XP_Bool redraw = XP_FALSE;
|
XP_Bool redraw = XP_FALSE;
|
||||||
|
|
||||||
*workRemainsP = XP_FALSE; /* in case we exit without calling engine */
|
*workRemainsP = XP_FALSE; /* in case we exit without calling engine */
|
||||||
|
|
||||||
selPlayer = board->selPlayer;
|
selPlayer = board->selPlayer;
|
||||||
engine = server_getEngineFor( board->server, selPlayer );
|
engine = server_getEngineFor( board->server, selPlayer );
|
||||||
|
@ -2219,12 +2219,12 @@ askRevealTray( BoardCtxt* board )
|
||||||
justReverse = XP_TRUE;
|
justReverse = XP_TRUE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
revealed = !player_hasPasswd( lp );
|
revealed = !player_hasPasswd( lp );
|
||||||
|
|
||||||
if ( !revealed ) {
|
if ( !revealed ) {
|
||||||
const XP_UCHAR* name = emptyStringIfNull(lp->name);
|
const XP_UCHAR* name = emptyStringIfNull(lp->name);
|
||||||
|
|
||||||
/* repeat until player gets passwd right or hits cancel */
|
/* repeat until player gets passwd right or hits cancel */
|
||||||
for ( ; ; ) {
|
for ( ; ; ) {
|
||||||
XP_UCHAR buf[16];
|
XP_UCHAR buf[16];
|
||||||
XP_U16 buflen = sizeof(buf);
|
XP_U16 buflen = sizeof(buf);
|
||||||
|
@ -2236,10 +2236,10 @@ askRevealTray( BoardCtxt* board )
|
||||||
revealed = XP_TRUE;
|
revealed = XP_TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( revealed ) {
|
if ( revealed ) {
|
||||||
setTrayVisState( board, TRAY_REVEALED );
|
setTrayVisState( board, TRAY_REVEALED );
|
||||||
|
@ -2320,7 +2320,7 @@ board_handlePenDown( BoardCtxt* board, XP_U16 x, XP_U16 y, XP_Bool* handled )
|
||||||
}
|
}
|
||||||
*handled = penDidSomething;
|
*handled = penDidSomething;
|
||||||
|
|
||||||
return result; /* no redraw needed */
|
return result; /* no redraw needed */
|
||||||
} /* board_handlePenDown */
|
} /* board_handlePenDown */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -2393,7 +2393,7 @@ tryMoveArrow( BoardCtxt* board, XP_U16 col, XP_U16 row )
|
||||||
board->trayVisState == TRAY_REVEALED ) ) {
|
board->trayVisState == TRAY_REVEALED ) ) {
|
||||||
|
|
||||||
BoardArrow* arrow = &board->boardArrow[board->selPlayer];
|
BoardArrow* arrow = &board->boardArrow[board->selPlayer];
|
||||||
|
|
||||||
if ( arrow->visible && arrow->col == col && arrow->row == row ) {
|
if ( arrow->visible && arrow->col == col && arrow->row == row ) {
|
||||||
/* change it; if vertical, hide; else if horizontal make
|
/* change it; if vertical, hide; else if horizontal make
|
||||||
vertical */
|
vertical */
|
||||||
|
@ -2886,7 +2886,7 @@ advanceArrow( BoardCtxt* board )
|
||||||
{
|
{
|
||||||
XP_Key key = board->boardArrow[board->selPlayer].vert ?
|
XP_Key key = board->boardArrow[board->selPlayer].vert ?
|
||||||
XP_CURSOR_KEY_DOWN : XP_CURSOR_KEY_RIGHT;
|
XP_CURSOR_KEY_DOWN : XP_CURSOR_KEY_RIGHT;
|
||||||
|
|
||||||
XP_ASSERT( board->trayVisState == TRAY_REVEALED );
|
XP_ASSERT( board->trayVisState == TRAY_REVEALED );
|
||||||
|
|
||||||
return board_moveArrow( board, key );
|
return board_moveArrow( board, key );
|
||||||
|
@ -2913,7 +2913,7 @@ figureNextLoc( BoardCtxt* board, XP_Key cursorKey,
|
||||||
numCols = model_numCols( board->model );
|
numCols = model_numCols( board->model );
|
||||||
|
|
||||||
switch ( cursorKey ) {
|
switch ( cursorKey ) {
|
||||||
|
|
||||||
case XP_CURSOR_KEY_DOWN:
|
case XP_CURSOR_KEY_DOWN:
|
||||||
incr = 1;
|
incr = 1;
|
||||||
useWhat = (XP_S16*)rowP;
|
useWhat = (XP_S16*)rowP;
|
||||||
|
@ -3139,7 +3139,7 @@ keyToIndex( BoardCtxt* board, XP_Key key, Tile* blankFace )
|
||||||
if ( tileIndex < 0 ) {
|
if ( tileIndex < 0 ) {
|
||||||
Tile blankTile = dict_getBlankTile( dict );
|
Tile blankTile = dict_getBlankTile( dict );
|
||||||
tileIndex = model_trayContains( model, turn, blankTile );
|
tileIndex = model_trayContains( model, turn, blankTile );
|
||||||
if ( tileIndex >= 0 && !!blankFace ) { /* there's a blank for it */
|
if ( tileIndex >= 0 && !!blankFace ) { /* there's a blank for it */
|
||||||
*blankFace = tile;
|
*blankFace = tile;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3322,7 +3322,7 @@ static void
|
||||||
boardGameOver( void* closure )
|
boardGameOver( void* closure )
|
||||||
{
|
{
|
||||||
BoardCtxt* board = (BoardCtxt*)closure;
|
BoardCtxt* board = (BoardCtxt*)closure;
|
||||||
board->scoreBoardInvalid = XP_TRUE; /* not sure if this will do it. */
|
board->scoreBoardInvalid = XP_TRUE; /* not sure if this will do it. */
|
||||||
board->gameOver = XP_TRUE;
|
board->gameOver = XP_TRUE;
|
||||||
util_notifyGameOver( board->util );
|
util_notifyGameOver( board->util );
|
||||||
} /* boardGameOver */
|
} /* boardGameOver */
|
||||||
|
|
|
@ -53,7 +53,7 @@ typedef enum {
|
||||||
XP_KEY_LAST
|
XP_KEY_LAST
|
||||||
} XP_Key;
|
} XP_Key;
|
||||||
|
|
||||||
#define BONUS_HINT_INTERVAL 15 /* stolen from xwords.c */
|
#define BONUS_HINT_INTERVAL 15 /* stolen from xwords.c */
|
||||||
|
|
||||||
/* typedef struct BoardCtxt BoardCtxt; */
|
/* typedef struct BoardCtxt BoardCtxt; */
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#include "model.h"
|
#include "model.h"
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
#include "engine.h"
|
#include "engine.h"
|
||||||
#include "mempool.h" /* debug only */
|
#include "mempool.h" /* debug only */
|
||||||
|
|
||||||
#ifdef CPLUS
|
#ifdef CPLUS
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -66,10 +66,10 @@ typedef struct DragState {
|
||||||
} DragState;
|
} DragState;
|
||||||
|
|
||||||
typedef struct BoardArrow { /* gets flipped along with board */
|
typedef struct BoardArrow { /* gets flipped along with board */
|
||||||
XP_U8 col;
|
XP_U8 col;
|
||||||
XP_U8 row;
|
XP_U8 row;
|
||||||
XP_Bool vert;
|
XP_Bool vert;
|
||||||
XP_Bool visible;
|
XP_Bool visible;
|
||||||
} BoardArrow;
|
} BoardArrow;
|
||||||
|
|
||||||
#ifdef KEYBOARD_NAV
|
#ifdef KEYBOARD_NAV
|
||||||
|
@ -90,7 +90,7 @@ typedef struct MiniWindowStuff {
|
||||||
} MiniWindowStuff;
|
} MiniWindowStuff;
|
||||||
|
|
||||||
enum { MINIWINDOW_VALHINT, MINIWINDOW_TRADING };
|
enum { MINIWINDOW_VALHINT, MINIWINDOW_TRADING };
|
||||||
typedef XP_U16 MiniWindowType; /* one of the two above */
|
typedef XP_U16 MiniWindowType; /* one of the two above */
|
||||||
|
|
||||||
struct BoardCtxt {
|
struct BoardCtxt {
|
||||||
/* BoardVTable* vtable; */
|
/* BoardVTable* vtable; */
|
||||||
|
@ -106,8 +106,8 @@ struct BoardCtxt {
|
||||||
XP_U16 yOffset;
|
XP_U16 yOffset;
|
||||||
XP_U16 lastVisibleRow;
|
XP_U16 lastVisibleRow;
|
||||||
XP_U16 preHideYOffset;
|
XP_U16 preHideYOffset;
|
||||||
XP_U16 prevYScrollOffset; /* represents where the last draw took place;
|
XP_U16 prevYScrollOffset; /* represents where the last draw took place;
|
||||||
used to see if bit scrolling can be used */
|
used to see if bit scrolling can be used */
|
||||||
XP_U16 penDownX;
|
XP_U16 penDownX;
|
||||||
XP_U16 penDownY;
|
XP_U16 penDownY;
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ struct BoardCtxt {
|
||||||
XP_Bool eraseTray;
|
XP_Bool eraseTray;
|
||||||
XP_Bool boardObscuresTray;
|
XP_Bool boardObscuresTray;
|
||||||
XP_Bool boardHidesTray;
|
XP_Bool boardHidesTray;
|
||||||
XP_Bool scoreSplitHor; /* how to divide the scoreboard? */
|
XP_Bool scoreSplitHor;/* how to divide the scoreboard? */
|
||||||
|
|
||||||
XP_U16 star_row;
|
XP_U16 star_row;
|
||||||
|
|
||||||
|
@ -150,21 +150,21 @@ struct BoardCtxt {
|
||||||
BdCursorLoc bdCursor[MAX_NUM_PLAYERS];
|
BdCursorLoc bdCursor[MAX_NUM_PLAYERS];
|
||||||
XP_Bool focusHasDived;
|
XP_Bool focusHasDived;
|
||||||
#endif
|
#endif
|
||||||
XP_U8 dividerLoc[MAX_NUM_PLAYERS]; /* 0 means left of 0th tile, etc. */
|
XP_U8 dividerLoc[MAX_NUM_PLAYERS]; /* 0 means left of 0th tile, etc. */
|
||||||
|
|
||||||
XP_U16 scoreDims[MAX_NUM_PLAYERS];
|
XP_U16 scoreDims[MAX_NUM_PLAYERS];
|
||||||
|
|
||||||
/* scoreboard state */
|
/* scoreboard state */
|
||||||
XP_Rect scoreBdBounds;
|
XP_Rect scoreBdBounds;
|
||||||
XP_Rect timerBounds;
|
XP_Rect timerBounds;
|
||||||
XP_U8 selPlayer; /* which player is selected (!= turn) */
|
XP_U8 selPlayer; /* which player is selected (!= turn) */
|
||||||
|
|
||||||
/* tray state */
|
/* tray state */
|
||||||
XP_U8 trayScaleH;
|
XP_U8 trayScaleH;
|
||||||
XP_U8 trayScaleV;
|
XP_U8 trayScaleV;
|
||||||
XP_Rect trayBounds;
|
XP_Rect trayBounds;
|
||||||
XP_U16 remDim; /* width (or ht) of the "rem:" string in scoreboard */
|
XP_U16 remDim; /* width (or ht) of the "rem:" string in scoreboard */
|
||||||
XP_U8 dividerWidth; /* 0 would mean invisible */
|
XP_U8 dividerWidth; /* 0 would mean invisible */
|
||||||
XP_Bool dividerInvalid;
|
XP_Bool dividerInvalid;
|
||||||
|
|
||||||
XP_Bool scoreBoardInvalid;
|
XP_Bool scoreBoardInvalid;
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
#ifndef _COMMMGR_H_
|
#ifndef _COMMMGR_H_
|
||||||
#define _COMMMGR_H_
|
#define _COMMMGR_H_
|
||||||
|
|
||||||
#include "comtypes.h" /* that's *common* types */
|
#include "comtypes.h" /* that's *common* types */
|
||||||
#include "xwstream.h"
|
#include "xwstream.h"
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
|
|
||||||
|
|
|
@ -66,8 +66,8 @@ typedef struct AddressRecord {
|
||||||
XP_U16 lastACK;
|
XP_U16 lastACK;
|
||||||
XP_U16 nUniqueBytes;
|
XP_U16 nUniqueBytes;
|
||||||
#endif
|
#endif
|
||||||
MsgID nextMsgID; /* on a per-channel basis */
|
MsgID nextMsgID; /* on a per-channel basis */
|
||||||
MsgID lastMsgRcd; /* on a per-channel basis */
|
MsgID lastMsgRcd; /* on a per-channel basis */
|
||||||
/* only used if COMMS_HEARTBEAT set except for serialization (to_stream) */
|
/* only used if COMMS_HEARTBEAT set except for serialization (to_stream) */
|
||||||
XP_PlayerAddr channelNo;
|
XP_PlayerAddr channelNo;
|
||||||
struct {
|
struct {
|
||||||
|
@ -90,7 +90,7 @@ typedef enum {
|
||||||
struct CommsCtxt {
|
struct CommsCtxt {
|
||||||
XW_UtilCtxt* util;
|
XW_UtilCtxt* util;
|
||||||
|
|
||||||
XP_U32 connID; /* 0 means ignore; otherwise must match */
|
XP_U32 connID; /* 0 means ignore; otherwise must match */
|
||||||
XP_PlayerAddr nextChannelNo;
|
XP_PlayerAddr nextChannelNo;
|
||||||
|
|
||||||
AddressRecord* recs; /* return addresses */
|
AddressRecord* recs; /* return addresses */
|
||||||
|
@ -591,7 +591,7 @@ comms_setAddr( CommsCtxt* comms, const CommsAddrRec* addr )
|
||||||
|
|
||||||
void
|
void
|
||||||
comms_getInitialAddr( CommsAddrRec* addr )
|
comms_getInitialAddr( CommsAddrRec* addr )
|
||||||
{
|
{
|
||||||
#if defined XWFEATURE_RELAY
|
#if defined XWFEATURE_RELAY
|
||||||
addr->conType = COMMS_CONN_RELAY; /* for temporary ease in debugging */
|
addr->conType = COMMS_CONN_RELAY; /* for temporary ease in debugging */
|
||||||
addr->u.ip_relay.ipAddr = 0L; /* force 'em to set it */
|
addr->u.ip_relay.ipAddr = 0L; /* force 'em to set it */
|
||||||
|
@ -662,7 +662,7 @@ makeElemWithID( CommsCtxt* comms, MsgID msgID, AddressRecord* rec,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
newMsgElem = (MsgQueueElem*)XP_MALLOC( comms->mpool,
|
newMsgElem = (MsgQueueElem*)XP_MALLOC( comms->mpool,
|
||||||
sizeof( *newMsgElem ) );
|
sizeof( *newMsgElem ) );
|
||||||
newMsgElem->channelNo = channelNo;
|
newMsgElem->channelNo = channelNo;
|
||||||
newMsgElem->msgID = msgID;
|
newMsgElem->msgID = msgID;
|
||||||
#ifdef COMMS_HEARTBEAT
|
#ifdef COMMS_HEARTBEAT
|
||||||
|
|
|
@ -70,7 +70,7 @@ typedef enum {
|
||||||
} DrawFocusState;
|
} DrawFocusState;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
TRAY_HIDDEN, /* doesn't happen unless tray overlaps board */
|
TRAY_HIDDEN, /* doesn't happen unless tray overlaps board */
|
||||||
TRAY_REVERSED,
|
TRAY_REVERSED,
|
||||||
TRAY_REVEALED
|
TRAY_REVEALED
|
||||||
} XW_TrayVisState;
|
} XW_TrayVisState;
|
||||||
|
|
|
@ -74,9 +74,9 @@ typedef struct dawg_header {
|
||||||
/* Part of xwords3 dictionaries on PalmOS */
|
/* Part of xwords3 dictionaries on PalmOS */
|
||||||
typedef struct Xloc_header {
|
typedef struct Xloc_header {
|
||||||
unsigned char langCodeFlags; /* can't do bitfields; gcc for pilot and x86
|
unsigned char langCodeFlags; /* can't do bitfields; gcc for pilot and x86
|
||||||
seem to generate different code */
|
seem to generate different code */
|
||||||
unsigned char padding; /* ptrs to the shorts in Xloc_specialEntry
|
unsigned char padding; /* ptrs to the shorts in Xloc_specialEntry
|
||||||
will otherwise be odd */
|
will otherwise be odd */
|
||||||
} Xloc_header;
|
} Xloc_header;
|
||||||
|
|
||||||
typedef struct Xloc_specialEntry {
|
typedef struct Xloc_specialEntry {
|
||||||
|
|
|
@ -39,7 +39,7 @@ setBlankTile( DictionaryCtxt* dctx )
|
||||||
{
|
{
|
||||||
XP_U16 i;
|
XP_U16 i;
|
||||||
|
|
||||||
dctx->blankTile = -1; /* no known blank */
|
dctx->blankTile = -1; /* no known blank */
|
||||||
|
|
||||||
for ( i = 0; i < dctx->nFaces; ++i ) {
|
for ( i = 0; i < dctx->nFaces; ++i ) {
|
||||||
if ( dctx->faces16[i] == 0 ) {
|
if ( dctx->faces16[i] == 0 ) {
|
||||||
|
@ -395,33 +395,33 @@ dict_getLangCode( const DictionaryCtxt* dict )
|
||||||
|
|
||||||
static XP_U8 stub_english_data[] = {
|
static XP_U8 stub_english_data[] = {
|
||||||
/* count value face */
|
/* count value face */
|
||||||
9, 1, 'A',
|
9, 1, 'A',
|
||||||
2, 3, 'B',
|
2, 3, 'B',
|
||||||
2, 3, 'C',
|
2, 3, 'C',
|
||||||
4, 2, 'D',
|
4, 2, 'D',
|
||||||
12, 1, 'E',
|
12, 1, 'E',
|
||||||
2, 4, 'F',
|
2, 4, 'F',
|
||||||
3, 2, 'G',
|
3, 2, 'G',
|
||||||
2, 4, 'H',
|
2, 4, 'H',
|
||||||
9, 1, 'I',
|
9, 1, 'I',
|
||||||
1, 8, 'J',
|
1, 8, 'J',
|
||||||
1, 5, 'K',
|
1, 5, 'K',
|
||||||
4, 1, 'L',
|
4, 1, 'L',
|
||||||
2, 3, 'M',
|
2, 3, 'M',
|
||||||
6, 1, 'N',
|
6, 1, 'N',
|
||||||
8, 1, 'O',
|
8, 1, 'O',
|
||||||
2, 3, 'P',
|
2, 3, 'P',
|
||||||
1, 10, 'Q',
|
1, 10, 'Q',
|
||||||
6, 1, 'R',
|
6, 1, 'R',
|
||||||
4, 1, 'S',
|
4, 1, 'S',
|
||||||
6, 1, 'T',
|
6, 1, 'T',
|
||||||
4, 1, 'U',
|
4, 1, 'U',
|
||||||
2, 4, 'V',
|
2, 4, 'V',
|
||||||
2, 4, 'W',
|
2, 4, 'W',
|
||||||
1, 8, 'X',
|
1, 8, 'X',
|
||||||
2, 4, 'Y',
|
2, 4, 'Y',
|
||||||
1, 10, 'Z',
|
1, 10, 'Z',
|
||||||
2, 0, BLANK_FACE, /* BLANK1 */
|
2, 0, BLANK_FACE, /* BLANK1 */
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -65,8 +65,8 @@ struct DictionaryCtxt {
|
||||||
const XP_UCHAR* (*func_dict_getShortName)( const DictionaryCtxt* dict );
|
const XP_UCHAR* (*func_dict_getShortName)( const DictionaryCtxt* dict );
|
||||||
|
|
||||||
array_edge* topEdge;
|
array_edge* topEdge;
|
||||||
array_edge* base; /* the physical beginning of the dictionary; not
|
array_edge* base; /* the physical beginning of the dictionary; not
|
||||||
necessarily the entry point for search!! */
|
necessarily the entry point for search!! */
|
||||||
XP_UCHAR* name;
|
XP_UCHAR* name;
|
||||||
XP_CHAR16* faces16; /* 16 for unicode */
|
XP_CHAR16* faces16; /* 16 for unicode */
|
||||||
XP_U8* countsAndValues;
|
XP_U8* countsAndValues;
|
||||||
|
@ -84,7 +84,7 @@ struct DictionaryCtxt {
|
||||||
XP_Bool is_4_byte;
|
XP_Bool is_4_byte;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
XP_S8 blankTile; /* negative means there's no known blank */
|
XP_S8 blankTile; /* negative means there's no known blank */
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
XP_U32 numEdges;
|
XP_U32 numEdges;
|
||||||
#endif
|
#endif
|
||||||
|
@ -97,7 +97,7 @@ struct DictionaryCtxt {
|
||||||
/* typedef struct DictionaryVtable { */
|
/* typedef struct DictionaryVtable { */
|
||||||
/* XP_U16 (*m_getTileValue)( DictionaryCtxt* ctxt, CellTile tile ); */
|
/* XP_U16 (*m_getTileValue)( DictionaryCtxt* ctxt, CellTile tile ); */
|
||||||
/* unsigned char (*m_getTileChar)( DictionaryCtxt* ctxt, CellTile tile, */
|
/* unsigned char (*m_getTileChar)( DictionaryCtxt* ctxt, CellTile tile, */
|
||||||
/* XP_FontCode* fontCode ); */
|
/* XP_FontCode* fontCode ); */
|
||||||
/* XP_U16 (*m_numTiles)( DictionaryCtxt* ctxt, Tile tile ); */
|
/* XP_U16 (*m_numTiles)( DictionaryCtxt* ctxt, Tile tile ); */
|
||||||
/* XP_U16 (*m_numTileFaces)( DictionaryCtxt* ctxt ); */
|
/* XP_U16 (*m_numTileFaces)( DictionaryCtxt* ctxt ); */
|
||||||
/* } DictionaryVtable; */
|
/* } DictionaryVtable; */
|
||||||
|
|
|
@ -305,7 +305,7 @@ default_draw_getMiniWText( DrawCtx* dctx, XWMiniTextType textHint )
|
||||||
str = "Triple letter"; break;
|
str = "Triple letter"; break;
|
||||||
case BONUS_TRIPLE_WORD:
|
case BONUS_TRIPLE_WORD:
|
||||||
str = "Triple word"; break;
|
str = "Triple word"; break;
|
||||||
case INTRADE_MW_TEXT:
|
case INTRADE_MW_TEXT:
|
||||||
str = "Trading tiles;\nclick D when done"; break;
|
str = "Trading tiles;\nclick D when done"; break;
|
||||||
default:
|
default:
|
||||||
XP_ASSERT( XP_FALSE );
|
XP_ASSERT( XP_FALSE );
|
||||||
|
|
|
@ -48,7 +48,7 @@ typedef struct DrawScoreInfo {
|
||||||
XP_UCHAR* name;
|
XP_UCHAR* name;
|
||||||
XP_U16 playerNum;
|
XP_U16 playerNum;
|
||||||
XP_S16 totalScore;
|
XP_S16 totalScore;
|
||||||
XP_S16 nTilesLeft; /* < 0 means don't use */
|
XP_S16 nTilesLeft; /* < 0 means don't use */
|
||||||
CellFlags flags;
|
CellFlags flags;
|
||||||
XP_Bool isTurn;
|
XP_Bool isTurn;
|
||||||
XP_Bool selected;
|
XP_Bool selected;
|
||||||
|
|
|
@ -39,11 +39,11 @@ typedef struct BlankTuple {
|
||||||
} BlankTuple;
|
} BlankTuple;
|
||||||
|
|
||||||
typedef struct PossibleMove {
|
typedef struct PossibleMove {
|
||||||
XP_U16 score; /* Because I'm doing a memcmp to sort these things,
|
XP_U16 score; /* Because I'm doing a memcmp to sort these things,
|
||||||
the comparison must be done differently on
|
the comparison must be done differently on
|
||||||
little-endian platforms. */
|
little-endian platforms. */
|
||||||
MoveInfo moveInfo;
|
MoveInfo moveInfo;
|
||||||
//XP_U16 whichBlanks; /* flags */
|
//XP_U16 whichBlanks; /* flags */
|
||||||
Tile blankVals[MAX_COLS]; /* the faces for which we've substituted
|
Tile blankVals[MAX_COLS]; /* the faces for which we've substituted
|
||||||
blanks */
|
blanks */
|
||||||
} PossibleMove;
|
} PossibleMove;
|
||||||
|
@ -357,7 +357,7 @@ chooseMove( EngineCtxt* engine, PossibleMove** move )
|
||||||
chosen = &engine->miData.savedMoves[--engine->miData.leftInMoveCache];
|
chosen = &engine->miData.savedMoves[--engine->miData.leftInMoveCache];
|
||||||
}
|
}
|
||||||
|
|
||||||
*move = chosen; /* set either way */
|
*move = chosen; /* set either way */
|
||||||
|
|
||||||
if ( chosen->score > 0 ) {
|
if ( chosen->score > 0 ) {
|
||||||
|
|
||||||
|
@ -565,9 +565,6 @@ findMovesOneRow( EngineCtxt* engine )
|
||||||
&engine->scoreCache[col],
|
&engine->scoreCache[col],
|
||||||
&engine->rowChecks[col]);
|
&engine->rowChecks[col]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XP_DEBUGF( "row %d: set scoreCache[%d] to %d\n", row, col, */
|
|
||||||
/* engine->scoreCache[col] ); */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
prevAnchor = firstSearchCol - 1;
|
prevAnchor = firstSearchCol - 1;
|
||||||
|
@ -1056,7 +1053,8 @@ considerMove( EngineCtxt* engine, Tile* tiles, XP_S16 tileLength,
|
||||||
== EMPTY_TILE ) {
|
== EMPTY_TILE ) {
|
||||||
posmove.moveInfo.tiles[posmove.moveInfo.nTiles].tile =
|
posmove.moveInfo.tiles[posmove.moveInfo.nTiles].tile =
|
||||||
tiles[posmove.moveInfo.nTiles];
|
tiles[posmove.moveInfo.nTiles];
|
||||||
posmove.moveInfo.tiles[posmove.moveInfo.nTiles].varCoord = (XP_U8)col;
|
posmove.moveInfo.tiles[posmove.moveInfo.nTiles].varCoord
|
||||||
|
= (XP_U8)col;
|
||||||
++posmove.moveInfo.nTiles;
|
++posmove.moveInfo.nTiles;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1094,11 +1092,9 @@ considerScoreWordHasBlanks( EngineCtxt* engine, XP_U16 blanksLeft,
|
||||||
for ( i = 0; i < usedBlanksCount; ++i ) {
|
for ( i = 0; i < usedBlanksCount; ++i ) {
|
||||||
short col = usedBlanks[i].col;
|
short col = usedBlanks[i].col;
|
||||||
posmove->blankVals[col] = usedBlanks[i].tile;
|
posmove->blankVals[col] = usedBlanks[i].tile;
|
||||||
/* posmove->whichBlanks |= (1 << col); */
|
|
||||||
}
|
}
|
||||||
XP_ASSERT( posmove->moveInfo.isHorizontal==
|
XP_ASSERT( posmove->moveInfo.isHorizontal==
|
||||||
engine->searchHorizontal );
|
engine->searchHorizontal );
|
||||||
/* posmove->moveInfo.isHorizontal = engine->searchHorizontal; */
|
|
||||||
posmove->moveInfo.commonCoord = (XP_U8)lastRow;
|
posmove->moveInfo.commonCoord = (XP_U8)lastRow;
|
||||||
saveMoveIfQualifies( engine, posmove );
|
saveMoveIfQualifies( engine, posmove );
|
||||||
}
|
}
|
||||||
|
@ -1134,7 +1130,7 @@ saveMoveIfQualifies( EngineCtxt* engine, PossibleMove* posmove )
|
||||||
{
|
{
|
||||||
XP_S16 lowest = 0;
|
XP_S16 lowest = 0;
|
||||||
|
|
||||||
if ( !engine->isRobot ) { /* robot doesn't ask for next hint.... */
|
if ( !engine->isRobot ) { /* robot doesn't ask for next hint.... */
|
||||||
|
|
||||||
/* we're not interested if we've seen this */
|
/* we're not interested if we've seen this */
|
||||||
if ( CMPMOVES( posmove, &engine->miData.lastSeenMove ) >= 0 ) {
|
if ( CMPMOVES( posmove, &engine->miData.lastSeenMove ) >= 0 ) {
|
||||||
|
@ -1154,9 +1150,9 @@ saveMoveIfQualifies( EngineCtxt* engine, PossibleMove* posmove )
|
||||||
/* 1/20/2001 I don't see that this assertion is valid. I
|
/* 1/20/2001 I don't see that this assertion is valid. I
|
||||||
simply don't understand why it isn't tripped all the time
|
simply don't understand why it isn't tripped all the time
|
||||||
in the old crosswords. */
|
in the old crosswords. */
|
||||||
/* XP_ASSERT( (engine->miData.lastSeenMove.score == 0x7fff) */
|
/* XP_ASSERT( (engine->miData.lastSeenMove.score == 0x7fff) */
|
||||||
/* || (engine->miData.savedMoves[i].score */
|
/* || (engine->miData.savedMoves[i].score */
|
||||||
/* <= posmove->score) ); */
|
/* <= posmove->score) ); */
|
||||||
|
|
||||||
if ( CMPMOVES( &engine->miData.savedMoves[lowest],
|
if ( CMPMOVES( &engine->miData.savedMoves[lowest],
|
||||||
&engine->miData.savedMoves[i] ) > 0 ) {
|
&engine->miData.savedMoves[i] ) > 0 ) {
|
||||||
|
@ -1170,13 +1166,13 @@ saveMoveIfQualifies( EngineCtxt* engine, PossibleMove* posmove )
|
||||||
lower than this for the rest of this round. */
|
lower than this for the rest of this round. */
|
||||||
engine->miData.lowestSavedScore =
|
engine->miData.lowestSavedScore =
|
||||||
engine->miData.savedMoves[lowest].score;
|
engine->miData.savedMoves[lowest].score;
|
||||||
/* XP_DEBUGF( "lowestSavedScore now %d\n", */
|
/* XP_DEBUGF( "lowestSavedScore now %d\n", */
|
||||||
/* engine->miData.lowestSavedScore ); */
|
/* engine->miData.lowestSavedScore ); */
|
||||||
if ( CMPMOVES( posmove, &engine->miData.savedMoves[lowest]) > 0 ) {
|
if ( CMPMOVES( posmove, &engine->miData.savedMoves[lowest]) > 0 ) {
|
||||||
XP_MEMCPY( &engine->miData.savedMoves[lowest], posmove,
|
XP_MEMCPY( &engine->miData.savedMoves[lowest], posmove,
|
||||||
sizeof(engine->miData.savedMoves[lowest]) );
|
sizeof(engine->miData.savedMoves[lowest]) );
|
||||||
/* XP_DEBUGF( "just saved move with score %d\n", */
|
/* XP_DEBUGF( "just saved move with score %d\n", */
|
||||||
/* engine->miData.savedMoves[lowest].score ); */
|
/* engine->miData.savedMoves[lowest].score ); */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} /* saveMoveIfQualifies */
|
} /* saveMoveIfQualifies */
|
||||||
|
|
|
@ -48,7 +48,7 @@ void engine_init( EngineCtxt* ctxt );
|
||||||
void engine_reset( EngineCtxt* ctxt );
|
void engine_reset( EngineCtxt* ctxt );
|
||||||
void engine_destroy( EngineCtxt* ctxt );
|
void engine_destroy( EngineCtxt* ctxt );
|
||||||
|
|
||||||
#define NO_SCORE_LIMIT 10000 /* for targetScore */
|
#define NO_SCORE_LIMIT 10000 /* for targetScore */
|
||||||
XP_Bool engine_findMove( EngineCtxt* ctxt, const ModelCtxt* model,
|
XP_Bool engine_findMove( EngineCtxt* ctxt, const ModelCtxt* model,
|
||||||
const DictionaryCtxt* dict, const Tile* tiles,
|
const DictionaryCtxt* dict, const Tile* tiles,
|
||||||
XP_U16 nTiles,
|
XP_U16 nTiles,
|
||||||
|
|
|
@ -270,7 +270,7 @@ gi_initPlayerInfo( MPFORMAL CurGameInfo* gi, const XP_UCHAR* nameTemplate )
|
||||||
gi->nPlayers = 2;
|
gi->nPlayers = 2;
|
||||||
gi->boardSize = 15;
|
gi->boardSize = 15;
|
||||||
gi->robotSmartness = SMART_ROBOT;
|
gi->robotSmartness = SMART_ROBOT;
|
||||||
gi->gameSeconds = 25 * 60; /* 25 minute game is common? */
|
gi->gameSeconds = 25 * 60; /* 25 minute game is common? */
|
||||||
|
|
||||||
gi->confirmBTConnect = XP_TRUE;
|
gi->confirmBTConnect = XP_TRUE;
|
||||||
|
|
||||||
|
@ -284,7 +284,7 @@ gi_initPlayerInfo( MPFORMAL CurGameInfo* gi, const XP_UCHAR* nameTemplate )
|
||||||
fp->name = copyString( mpool, buf );
|
fp->name = copyString( mpool, buf );
|
||||||
}
|
}
|
||||||
|
|
||||||
fp->isRobot = (i == 0); /* one robot */
|
fp->isRobot = (i == 0); /* one robot */
|
||||||
fp->isLocal = XP_TRUE;
|
fp->isLocal = XP_TRUE;
|
||||||
fp->secondsUsed = 0;
|
fp->secondsUsed = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,8 +52,8 @@ typedef struct LocalPlayer {
|
||||||
typedef struct CurGameInfo {
|
typedef struct CurGameInfo {
|
||||||
XP_UCHAR* dictName;
|
XP_UCHAR* dictName;
|
||||||
LocalPlayer players[MAX_NUM_PLAYERS];
|
LocalPlayer players[MAX_NUM_PLAYERS];
|
||||||
XP_U16 gameID; /* uniquely identifies game */
|
XP_U16 gameID; /* uniquely identifies game */
|
||||||
XP_U16 gameSeconds; /* for timer */
|
XP_U16 gameSeconds; /* for timer */
|
||||||
XP_U8 nPlayers;
|
XP_U8 nPlayers;
|
||||||
XP_U8 boardSize;
|
XP_U8 boardSize;
|
||||||
DeviceRole serverRole;
|
DeviceRole serverRole;
|
||||||
|
|
|
@ -95,10 +95,10 @@ mpool_destroy( MemPoolCtx* mpool )
|
||||||
if ( !!mpool->usedList ) {
|
if ( !!mpool->usedList ) {
|
||||||
MemPoolEntry* entry;
|
MemPoolEntry* entry;
|
||||||
for ( entry = mpool->usedList; !!entry; entry = entry->next ) {
|
for ( entry = mpool->usedList; !!entry; entry = entry->next ) {
|
||||||
#ifndef FOR_GREMLINS /* I don't want to hear about this right now */
|
#ifndef FOR_GREMLINS /* I don't want to hear about this right now */
|
||||||
XP_WARNF( "0x" XP_P " from ln %ld of %s\n",
|
XP_WARNF( "0x" XP_P " from ln %ld of %s\n",
|
||||||
entry->ptr, entry->lineNo, entry->fileName );
|
entry->ptr, entry->lineNo, entry->fileName );
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
{
|
{
|
||||||
char* tryTxt;
|
char* tryTxt;
|
||||||
tryTxt = checkIsText( entry );
|
tryTxt = checkIsText( entry );
|
||||||
|
|
|
@ -35,7 +35,7 @@ extern "C" {
|
||||||
|
|
||||||
#define mEND 0x6d454e44
|
#define mEND 0x6d454e44
|
||||||
|
|
||||||
#define MAX_PASSES 2 /* how many times can all players pass? */
|
#define MAX_PASSES 2 /* how many times can all players pass? */
|
||||||
|
|
||||||
/****************************** prototypes ******************************/
|
/****************************** prototypes ******************************/
|
||||||
typedef void (*MovePrintFuncPre)(ModelCtxt*, XP_U16, StackEntry*, void*);
|
typedef void (*MovePrintFuncPre)(ModelCtxt*, XP_U16, StackEntry*, void*);
|
||||||
|
@ -212,7 +212,7 @@ buildModelFromStack( ModelCtxt* model, StackCtxt* stack,
|
||||||
{
|
{
|
||||||
StackEntry entry;
|
StackEntry entry;
|
||||||
XP_U16 i;
|
XP_U16 i;
|
||||||
XP_S16 moveScore = 0; /* keep compiler happy */
|
XP_S16 moveScore = 0; /* keep compiler happy */
|
||||||
|
|
||||||
for ( i = 0; stack_getNthEntry( stack, i, &entry ); ++i ) {
|
for ( i = 0; stack_getNthEntry( stack, i, &entry ); ++i ) {
|
||||||
|
|
||||||
|
@ -222,7 +222,7 @@ buildModelFromStack( ModelCtxt* model, StackCtxt* stack,
|
||||||
|
|
||||||
switch ( entry.moveType ) {
|
switch ( entry.moveType ) {
|
||||||
case MOVE_TYPE:
|
case MOVE_TYPE:
|
||||||
|
|
||||||
model_makeTurnFromMoveInfo( model, entry.playerNum,
|
model_makeTurnFromMoveInfo( model, entry.playerNum,
|
||||||
&entry.u.move.moveInfo);
|
&entry.u.move.moveInfo);
|
||||||
moveScore = commitTurn( model, entry.playerNum,
|
moveScore = commitTurn( model, entry.playerNum,
|
||||||
|
@ -236,7 +236,7 @@ buildModelFromStack( ModelCtxt* model, StackCtxt* stack,
|
||||||
assignPlayerTiles( model, entry.playerNum,
|
assignPlayerTiles( model, entry.playerNum,
|
||||||
&entry.u.assign.tiles );
|
&entry.u.assign.tiles );
|
||||||
break;
|
break;
|
||||||
case PHONY_TYPE: /* nothing to add */
|
case PHONY_TYPE: /* nothing to add */
|
||||||
model_makeTurnFromMoveInfo( model, entry.playerNum,
|
model_makeTurnFromMoveInfo( model, entry.playerNum,
|
||||||
&entry.u.phony.moveInfo);
|
&entry.u.phony.moveInfo);
|
||||||
/* do something here to cause it to print */
|
/* do something here to cause it to print */
|
||||||
|
@ -580,7 +580,7 @@ model_undoLatestMoves( ModelCtxt* model, PoolContext* pool,
|
||||||
/* get the tiles out of player's tray and back into the
|
/* get the tiles out of player's tray and back into the
|
||||||
pool */
|
pool */
|
||||||
replaceNewTiles( model, pool, turn, &entry.u.move.newTiles);
|
replaceNewTiles( model, pool, turn, &entry.u.move.newTiles);
|
||||||
|
|
||||||
undoFromMoveInfo( model, turn, blankTile,
|
undoFromMoveInfo( model, turn, blankTile,
|
||||||
&entry.u.move.moveInfo );
|
&entry.u.move.moveInfo );
|
||||||
} else if ( entry.moveType == TRADE_TYPE ) {
|
} else if ( entry.moveType == TRADE_TYPE ) {
|
||||||
|
@ -1214,7 +1214,7 @@ commitTurn( ModelCtxt* model, XP_S16 turn, TrayTileSet* newTiles,
|
||||||
XP_ASSERT( (tile & TILE_PENDING_BIT) != 0 );
|
XP_ASSERT( (tile & TILE_PENDING_BIT) != 0 );
|
||||||
|
|
||||||
val = tile & TILE_VALUE_MASK;
|
val = tile & TILE_VALUE_MASK;
|
||||||
if ( val > 1 ) { /* somebody else is using this square too! */
|
if ( val > 1 ) { /* somebody else is using this square too! */
|
||||||
putBackOtherPlayersTiles( model, turn, col, row );
|
putBackOtherPlayersTiles( model, turn, col, row );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1563,7 +1563,7 @@ printMovePost( ModelCtxt* model, XP_U16 XP_UNUSED(moveN), StackEntry* entry,
|
||||||
|
|
||||||
case PHONY_TYPE:
|
case PHONY_TYPE:
|
||||||
format = util_getUserString( model->vol.util, STR_PHONY_REJECTED );
|
format = util_getUserString( model->vol.util, STR_PHONY_REJECTED );
|
||||||
printString( stream, format );
|
printString( stream, format );
|
||||||
case MOVE_TYPE:
|
case MOVE_TYPE:
|
||||||
format = util_getUserString( model->vol.util, STRD_CUMULATIVE_SCORE );
|
format = util_getUserString( model->vol.util, STRD_CUMULATIVE_SCORE );
|
||||||
XP_SNPRINTF( buf, sizeof(buf), format, totalScore );
|
XP_SNPRINTF( buf, sizeof(buf), format, totalScore );
|
||||||
|
@ -1578,7 +1578,7 @@ printMovePost( ModelCtxt* model, XP_U16 XP_UNUSED(moveN), StackEntry* entry,
|
||||||
if ( nTiles > 0 ) {
|
if ( nTiles > 0 ) {
|
||||||
|
|
||||||
if ( entry->moveType == PHONY_TYPE ) {
|
if ( entry->moveType == PHONY_TYPE ) {
|
||||||
/* printString( stream, (XP_UCHAR*)"phony rejected " ); */
|
/* printString( stream, (XP_UCHAR*)"phony rejected " ); */
|
||||||
} else if ( !closure->keepHidden ) {
|
} else if ( !closure->keepHidden ) {
|
||||||
format = util_getUserString(model->vol.util, STRS_NEW_TILES);
|
format = util_getUserString(model->vol.util, STRS_NEW_TILES);
|
||||||
XP_SNPRINTF( buf, sizeof(buf), format,
|
XP_SNPRINTF( buf, sizeof(buf), format,
|
||||||
|
@ -1588,7 +1588,7 @@ printMovePost( ModelCtxt* model, XP_U16 XP_UNUSED(moveN), StackEntry* entry,
|
||||||
printString( stream, buf );
|
printString( stream, buf );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1743,7 +1743,7 @@ model_getPlayersLastScore( ModelCtxt* model, XP_S16 player,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( found ) { /* success? */
|
if ( found ) { /* success? */
|
||||||
const XP_UCHAR* format;
|
const XP_UCHAR* format;
|
||||||
XP_U16 nTiles;
|
XP_U16 nTiles;
|
||||||
switch ( entry.moveType ) {
|
switch ( entry.moveType ) {
|
||||||
|
|
|
@ -53,19 +53,19 @@ extern "C" {
|
||||||
#define CELL_OWNER_OFFSET 10
|
#define CELL_OWNER_OFFSET 10
|
||||||
#define CELL_OWNER(t) (((t)&CELL_OWNER_MASK) >> CELL_OWNER_OFFSET)
|
#define CELL_OWNER(t) (((t)&CELL_OWNER_MASK) >> CELL_OWNER_OFFSET)
|
||||||
|
|
||||||
#define MAX_UNIQUE_TILES 64 /* max tile non-blank faces */
|
#define MAX_UNIQUE_TILES 64 /* max tile non-blank faces */
|
||||||
#define MAX_NUM_BLANKS 4
|
#define MAX_NUM_BLANKS 4
|
||||||
|
|
||||||
/* Used by scoring code and engine as fast representation of moves. */
|
/* Used by scoring code and engine as fast representation of moves. */
|
||||||
typedef struct MoveInfoTile {
|
typedef struct MoveInfoTile {
|
||||||
XP_U8 varCoord; /* 5 bits ok (0-16 for 17x17 board) */
|
XP_U8 varCoord; /* 5 bits ok (0-16 for 17x17 board) */
|
||||||
Tile tile; /* 6 bits will do */
|
Tile tile; /* 6 bits will do */
|
||||||
} MoveInfoTile;
|
} MoveInfoTile;
|
||||||
|
|
||||||
typedef struct MoveInfo {
|
typedef struct MoveInfo {
|
||||||
XP_U8 nTiles; /* 4 bits: 0-7 */
|
XP_U8 nTiles; /* 4 bits: 0-7 */
|
||||||
XP_U8 commonCoord; /* 5 bits: 0-16 if 17x17 possible */
|
XP_U8 commonCoord; /* 5 bits: 0-16 if 17x17 possible */
|
||||||
XP_Bool isHorizontal; /* 1 bit */
|
XP_Bool isHorizontal; /* 1 bit */
|
||||||
/* If this is to go on an undo stack, we need player num here, or the code
|
/* If this is to go on an undo stack, we need player num here, or the code
|
||||||
has to keep track of it *and* there must be exactly one entry per
|
has to keep track of it *and* there must be exactly one entry per
|
||||||
player per turn. */
|
player per turn. */
|
||||||
|
@ -84,7 +84,7 @@ typedef struct BlankQueue {
|
||||||
XP_U8 row[MAX_NUM_BLANKS];
|
XP_U8 row[MAX_NUM_BLANKS];
|
||||||
} BlankQueue;
|
} BlankQueue;
|
||||||
|
|
||||||
typedef XP_U8 TileBit; /* bits indicating selection of tiles in tray */
|
typedef XP_U8 TileBit; /* bits indicating selection of tiles in tray */
|
||||||
#define ALLTILES ((TileBit)~(0xFF<<(MAX_TRAY_TILES)))
|
#define ALLTILES ((TileBit)~(0xFF<<(MAX_TRAY_TILES)))
|
||||||
|
|
||||||
#define ILLEGAL_MOVE_SCORE (-1)
|
#define ILLEGAL_MOVE_SCORE (-1)
|
||||||
|
@ -92,7 +92,7 @@ typedef XP_U8 TileBit; /* bits indicating selection of tiles in tray */
|
||||||
#define EMPTY_TILE TILE_EMPTY_BIT
|
#define EMPTY_TILE TILE_EMPTY_BIT
|
||||||
#define TILE_IS_EMPTY(t) (((t)&TILE_EMPTY_BIT)!=0)
|
#define TILE_IS_EMPTY(t) (((t)&TILE_EMPTY_BIT)!=0)
|
||||||
#define REVERSED_TILE TILE_PENDING_BIT /* reuse that bit for tile drawing
|
#define REVERSED_TILE TILE_PENDING_BIT /* reuse that bit for tile drawing
|
||||||
only */
|
only */
|
||||||
|
|
||||||
|
|
||||||
ModelCtxt* model_make( MPFORMAL DictionaryCtxt* dict, XW_UtilCtxt* util,
|
ModelCtxt* model_make( MPFORMAL DictionaryCtxt* dict, XW_UtilCtxt* util,
|
||||||
|
@ -146,8 +146,6 @@ void model_moveTileOnBoard( ModelCtxt* model, XP_S16 turn, XP_U16 colCur,
|
||||||
XP_S16 model_trayContains( ModelCtxt* model, XP_S16 turn, Tile tile );
|
XP_S16 model_trayContains( ModelCtxt* model, XP_S16 turn, Tile tile );
|
||||||
|
|
||||||
|
|
||||||
/* void model_setTile( ModelCtxt* model, XP_U16 col, XP_U16 row, */
|
|
||||||
/* Tile tile, XP_Bool isBlank ); */
|
|
||||||
XP_U16 model_numRows( const ModelCtxt* model );
|
XP_U16 model_numRows( const ModelCtxt* model );
|
||||||
XP_U16 model_numCols( const ModelCtxt* model );
|
XP_U16 model_numCols( const ModelCtxt* model );
|
||||||
|
|
||||||
|
|
|
@ -30,15 +30,15 @@ extern "C" {
|
||||||
typedef struct PendingTile {
|
typedef struct PendingTile {
|
||||||
XP_U8 col;
|
XP_U8 col;
|
||||||
XP_U8 row;
|
XP_U8 row;
|
||||||
Tile tile; /* includes face and blank bit */
|
Tile tile; /* includes face and blank bit */
|
||||||
} PendingTile;
|
} PendingTile;
|
||||||
|
|
||||||
typedef struct PlayerCtxt {
|
typedef struct PlayerCtxt {
|
||||||
XP_S16 score;
|
XP_S16 score;
|
||||||
XP_S16 curMoveScore; /* negative means illegal */
|
XP_S16 curMoveScore; /* negative means illegal */
|
||||||
XP_Bool curMoveValid;
|
XP_Bool curMoveValid;
|
||||||
TrayTileSet trayTiles;
|
TrayTileSet trayTiles;
|
||||||
XP_U8 nPending; /* still in tray but "on board" */
|
XP_U8 nPending; /* still in tray but "on board" */
|
||||||
PendingTile pendingTiles[MAX_TRAY_TILES];
|
PendingTile pendingTiles[MAX_TRAY_TILES];
|
||||||
} PlayerCtxt;
|
} PlayerCtxt;
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ struct ModelCtxt {
|
||||||
void invalidateScore( ModelCtxt* model, XP_S16 player );
|
void invalidateScore( ModelCtxt* model, XP_S16 player );
|
||||||
XP_Bool tilesInLine( ModelCtxt* model, XP_S16 turn, XP_Bool* isHorizontal );
|
XP_Bool tilesInLine( ModelCtxt* model, XP_S16 turn, XP_Bool* isHorizontal );
|
||||||
void normalizeMoves( ModelCtxt* model, XP_S16 turn,
|
void normalizeMoves( ModelCtxt* model, XP_S16 turn,
|
||||||
XP_Bool isHorizontal, MoveInfo* moveInfo );
|
XP_Bool isHorizontal, MoveInfo* moveInfo );
|
||||||
void adjustScoreForUndone( ModelCtxt* model, MoveInfo* mi, XP_U16 turn );
|
void adjustScoreForUndone( ModelCtxt* model, MoveInfo* mi, XP_U16 turn );
|
||||||
#ifdef CPLUS
|
#ifdef CPLUS
|
||||||
}
|
}
|
||||||
|
|
|
@ -272,14 +272,14 @@ stack_addPhony( StackCtxt* stack, XP_U16 turn, MoveInfo* moveInfo )
|
||||||
move.moveType = PHONY_TYPE;
|
move.moveType = PHONY_TYPE;
|
||||||
|
|
||||||
XP_MEMCPY( &move.u.phony.moveInfo, moveInfo,
|
XP_MEMCPY( &move.u.phony.moveInfo, moveInfo,
|
||||||
sizeof(move.u.phony.moveInfo));
|
sizeof(move.u.phony.moveInfo));
|
||||||
|
|
||||||
pushEntry( stack, &move );
|
pushEntry( stack, &move );
|
||||||
} /* stack_addPhony */
|
} /* stack_addPhony */
|
||||||
|
|
||||||
void
|
void
|
||||||
stack_addTrade( StackCtxt* stack, XP_U16 turn,
|
stack_addTrade( StackCtxt* stack, XP_U16 turn,
|
||||||
TrayTileSet* oldTiles, TrayTileSet* newTiles )
|
TrayTileSet* oldTiles, TrayTileSet* newTiles )
|
||||||
{
|
{
|
||||||
StackEntry move;
|
StackEntry move;
|
||||||
|
|
||||||
|
|
|
@ -75,10 +75,10 @@ void stack_loadFromStream( StackCtxt* stack, XWStreamCtxt* stream );
|
||||||
void stack_writeToStream( StackCtxt* stack, XWStreamCtxt* stream );
|
void stack_writeToStream( StackCtxt* stack, XWStreamCtxt* stream );
|
||||||
|
|
||||||
void stack_addMove( StackCtxt* stack, XP_U16 turn, MoveInfo* moveInfo,
|
void stack_addMove( StackCtxt* stack, XP_U16 turn, MoveInfo* moveInfo,
|
||||||
TrayTileSet* newTiles );
|
TrayTileSet* newTiles );
|
||||||
void stack_addPhony( StackCtxt* stack, XP_U16 turn, MoveInfo* moveInfo );
|
void stack_addPhony( StackCtxt* stack, XP_U16 turn, MoveInfo* moveInfo );
|
||||||
void stack_addTrade( StackCtxt* stack, XP_U16 turn,
|
void stack_addTrade( StackCtxt* stack, XP_U16 turn,
|
||||||
TrayTileSet* oldTiles, TrayTileSet* newTiles );
|
TrayTileSet* oldTiles, TrayTileSet* newTiles );
|
||||||
void stack_addAssign( StackCtxt* stack, XP_U16 turn, TrayTileSet* tiles );
|
void stack_addAssign( StackCtxt* stack, XP_U16 turn, TrayTileSet* tiles );
|
||||||
|
|
||||||
XP_U16 stack_getNEntries( StackCtxt* stack );
|
XP_U16 stack_getNEntries( StackCtxt* stack );
|
||||||
|
|
|
@ -40,10 +40,6 @@ static XP_U16 find_start( const ModelCtxt* model, XP_U16 col, XP_U16 row,
|
||||||
static XP_S16 checkScoreMove( ModelCtxt* model, XP_S16 turn,
|
static XP_S16 checkScoreMove( ModelCtxt* model, XP_S16 turn,
|
||||||
EngineCtxt* engine, XWStreamCtxt* stream,
|
EngineCtxt* engine, XWStreamCtxt* stream,
|
||||||
XP_Bool silent, WordNotifierInfo* notifyInfo );
|
XP_Bool silent, WordNotifierInfo* notifyInfo );
|
||||||
/* static XP_U16 figureWordScore( ModelCtxt* model, MoveInfo* moveInfo, */
|
|
||||||
/* EngineCtxt* engine, */
|
|
||||||
/* XP_Bool silent, short moveMultiplier, */
|
|
||||||
/* WordNotifierInfo* notifyInfo ); */
|
|
||||||
static XP_U16 scoreWord( const ModelCtxt* model, MoveInfo* movei,
|
static XP_U16 scoreWord( const ModelCtxt* model, MoveInfo* movei,
|
||||||
EngineCtxt* engine, XWStreamCtxt* stream,
|
EngineCtxt* engine, XWStreamCtxt* stream,
|
||||||
WordNotifierInfo* notifyInfo, XP_UCHAR* mainWord );
|
WordNotifierInfo* notifyInfo, XP_UCHAR* mainWord );
|
||||||
|
@ -243,7 +239,7 @@ checkScoreMove( ModelCtxt* model, XP_S16 turn, EngineCtxt* engine,
|
||||||
score = figureMoveScore( model, &moveInfo, engine, stream,
|
score = figureMoveScore( model, &moveInfo, engine, stream,
|
||||||
notifyInfo, NULL );
|
notifyInfo, NULL );
|
||||||
}
|
}
|
||||||
} else if ( !silent ) { /* tiles out of line */
|
} else if ( !silent ) { /* tiles out of line */
|
||||||
util_userError( model->vol.util, ERR_TILES_NOT_IN_LINE );
|
util_userError( model->vol.util, ERR_TILES_NOT_IN_LINE );
|
||||||
}
|
}
|
||||||
return score;
|
return score;
|
||||||
|
@ -401,13 +397,13 @@ isLegalMove( ModelCtxt* model, MoveInfo* mInfo, XP_Bool silent )
|
||||||
}
|
}
|
||||||
/* now the neighbors above... */
|
/* now the neighbors above... */
|
||||||
if ( commonCoord != 0 ) {
|
if ( commonCoord != 0 ) {
|
||||||
--*commonP; /* decrement whatever's not being looped over */
|
--*commonP; /* decrement whatever's not being looped over */
|
||||||
for ( *incr = low; *incr <= high; ++*incr ) {
|
for ( *incr = low; *incr <= high; ++*incr ) {
|
||||||
if ( !modelIsEmptyAt( model, col, row ) ) {
|
if ( !modelIsEmptyAt( model, col, row ) ) {
|
||||||
return XP_TRUE;
|
return XP_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
++*commonP; /* undo the decrement */
|
++*commonP;/* undo the decrement */
|
||||||
}
|
}
|
||||||
/* ...and below */
|
/* ...and below */
|
||||||
if ( commonCoord <= MAX_ROWS - 1 ) {
|
if ( commonCoord <= MAX_ROWS - 1 ) {
|
||||||
|
@ -419,7 +415,7 @@ isLegalMove( ModelCtxt* model, MoveInfo* mInfo, XP_Bool silent )
|
||||||
}
|
}
|
||||||
--*commonP;
|
--*commonP;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if we got here, it's illegal unless this is the first move -- i.e.
|
/* if we got here, it's illegal unless this is the first move -- i.e.
|
||||||
unless one of the tiles is on the STAR */
|
unless one of the tiles is on the STAR */
|
||||||
if ( ( commonCoord == star_row) &&
|
if ( ( commonCoord == star_row) &&
|
||||||
|
@ -440,7 +436,7 @@ isLegalMove( ModelCtxt* model, MoveInfo* mInfo, XP_Bool silent )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
XP_ASSERT( XP_FALSE );
|
XP_ASSERT( XP_FALSE );
|
||||||
return XP_FALSE; /* keep compiler happy */
|
return XP_FALSE; /* keep compiler happy */
|
||||||
} /* isLegalMove */
|
} /* isLegalMove */
|
||||||
|
|
||||||
XP_U16
|
XP_U16
|
||||||
|
@ -557,7 +553,7 @@ tile_multiplier( const ModelCtxt* model, XP_U16 col, XP_U16 row )
|
||||||
} /* tile_multiplier */
|
} /* tile_multiplier */
|
||||||
|
|
||||||
static XP_U16
|
static XP_U16
|
||||||
scoreWord( const ModelCtxt* model, MoveInfo* movei, /* new tiles */
|
scoreWord( const ModelCtxt* model, MoveInfo* movei, /* new tiles */
|
||||||
EngineCtxt* engine,/* for crosswise caching */
|
EngineCtxt* engine,/* for crosswise caching */
|
||||||
XWStreamCtxt* stream,
|
XWStreamCtxt* stream,
|
||||||
WordNotifierInfo* notifyInfo,
|
WordNotifierInfo* notifyInfo,
|
||||||
|
@ -611,12 +607,13 @@ scoreWord( const ModelCtxt* model, MoveInfo* movei, /* new tiles */
|
||||||
|
|
||||||
if ( engine != NULL ) {
|
if ( engine != NULL ) {
|
||||||
XP_ASSERT( nTiles==1 );
|
XP_ASSERT( nTiles==1 );
|
||||||
scoreFromCache = engine_getScoreCache( engine, movei->commonCoord );
|
scoreFromCache = engine_getScoreCache( engine,
|
||||||
|
movei->commonCoord );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* for a while, at least, calculate and use the cached crosscheck score
|
/* for a while, at least, calculate and use the cached crosscheck score
|
||||||
* each time through in the debug case */
|
* each time through in the debug case */
|
||||||
if ( 0 ) { /* makes keeping parens balanced easier */
|
if ( 0 ) { /* makes keeping parens balanced easier */
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
} else if ( 1 ) {
|
} else if ( 1 ) {
|
||||||
#else
|
#else
|
||||||
|
@ -650,13 +647,13 @@ scoreWord( const ModelCtxt* model, MoveInfo* movei, /* new tiles */
|
||||||
XP_ASSERT( (tile & TILE_VALUE_MASK) == tile );
|
XP_ASSERT( (tile & TILE_VALUE_MASK) == tile );
|
||||||
}
|
}
|
||||||
|
|
||||||
*curTile++ = tile; /* save in case we're checking phonies */
|
*curTile++ = tile; /* save in case we're checking phonies */
|
||||||
|
|
||||||
if ( !!stream || !!mainWord ) {
|
if ( !!stream || !!mainWord ) {
|
||||||
wordScoreFormatterAddTile( &fmtr, tile, tileMultiplier,
|
wordScoreFormatterAddTile( &fmtr, tile, tileMultiplier,
|
||||||
isBlank );
|
isBlank );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isBlank ) {
|
if ( isBlank ) {
|
||||||
tile = dict_getBlankTile( dict );
|
tile = dict_getBlankTile( dict );
|
||||||
}
|
}
|
||||||
|
@ -689,7 +686,7 @@ scoreWord( const ModelCtxt* model, MoveInfo* movei, /* new tiles */
|
||||||
|
|
||||||
} else if ( engine != NULL ) {
|
} else if ( engine != NULL ) {
|
||||||
#else
|
#else
|
||||||
} else { /* non-debug case we know it's non-null */
|
} else { /* non-debug case we know it's non-null */
|
||||||
#endif
|
#endif
|
||||||
XP_ASSERT( nTiles==1 );
|
XP_ASSERT( nTiles==1 );
|
||||||
XP_ASSERT( engine_getScoreCache( engine, movei->commonCoord )
|
XP_ASSERT( engine_getScoreCache( engine, movei->commonCoord )
|
||||||
|
|
|
@ -94,7 +94,7 @@ static Tile
|
||||||
getNthPoolTile( PoolContext* pool, short index )
|
getNthPoolTile( PoolContext* pool, short index )
|
||||||
{
|
{
|
||||||
Tile result;
|
Tile result;
|
||||||
|
|
||||||
/* given an array of counts of remaining letters, subtract each in turn
|
/* given an array of counts of remaining letters, subtract each in turn
|
||||||
from the total we seek until that total is at or below zero. The count
|
from the total we seek until that total is at or below zero. The count
|
||||||
that put it (or would put it) under 0 is the one to pick. */
|
that put it (or would put it) under 0 is the one to pick. */
|
||||||
|
@ -164,7 +164,7 @@ pool_replaceTiles( PoolContext* pool, TrayTileSet* tiles )
|
||||||
Tile* tilesP = tiles->tiles;
|
Tile* tilesP = tiles->tiles;
|
||||||
|
|
||||||
while ( nTiles-- ) {
|
while ( nTiles-- ) {
|
||||||
Tile tile = *tilesP++; /* do I need to filter off high bits? */
|
Tile tile = *tilesP++; /* do I need to filter off high bits? */
|
||||||
|
|
||||||
XP_ASSERT( nTiles < MAX_TRAY_TILES );
|
XP_ASSERT( nTiles < MAX_TRAY_TILES );
|
||||||
XP_ASSERT( tile < pool->numFaces );
|
XP_ASSERT( tile < pool->numFaces );
|
||||||
|
@ -183,7 +183,7 @@ pool_removeTiles( PoolContext* pool, TrayTileSet* tiles )
|
||||||
XP_ASSERT( nTiles <= MAX_TRAY_TILES );
|
XP_ASSERT( nTiles <= MAX_TRAY_TILES );
|
||||||
|
|
||||||
while ( nTiles-- ) {
|
while ( nTiles-- ) {
|
||||||
Tile tile = *tilesP++; /* do I need to filter off high bits? */
|
Tile tile = *tilesP++; /* do I need to filter off high bits? */
|
||||||
|
|
||||||
XP_ASSERT( tile < pool->numFaces );
|
XP_ASSERT( tile < pool->numFaces );
|
||||||
XP_ASSERT( pool->lettersLeft[tile] > 0 );
|
XP_ASSERT( pool->lettersLeft[tile] > 0 );
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
#include "model.h"
|
#include "model.h"
|
||||||
|
|
||||||
void pool_requestTiles( PoolContext* pool, Tile* tiles,
|
void pool_requestTiles( PoolContext* pool, Tile* tiles,
|
||||||
/*in out*/ XP_U8* maxNum );
|
/*in out*/ XP_U8* maxNum );
|
||||||
void pool_replaceTiles( PoolContext* pool, TrayTileSet* tiles );
|
void pool_replaceTiles( PoolContext* pool, TrayTileSet* tiles );
|
||||||
void pool_removeTiles( PoolContext* pool, TrayTileSet* tiles );
|
void pool_removeTiles( PoolContext* pool, TrayTileSet* tiles );
|
||||||
|
|
||||||
|
|
|
@ -159,7 +159,7 @@ drawScoreBoard( BoardCtxt* board )
|
||||||
*adjustPt += remDim;
|
*adjustPt += remDim;
|
||||||
}
|
}
|
||||||
|
|
||||||
board->remDim = remDim; /* save now so register can be reused */
|
board->remDim = remDim; /* save now so register can be reused */
|
||||||
|
|
||||||
for ( dp = datum, i = 0; i < nPlayers; ++dp, ++i ) {
|
for ( dp = datum, i = 0; i < nPlayers; ++dp, ++i ) {
|
||||||
XP_Rect innerRect;
|
XP_Rect innerRect;
|
||||||
|
@ -192,7 +192,7 @@ drawScoreBoard( BoardCtxt* board )
|
||||||
|
|
||||||
board->scoreBoardInvalid = XP_FALSE;
|
board->scoreBoardInvalid = XP_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
drawTimer( board );
|
drawTimer( board );
|
||||||
} /* drawScoreBoard */
|
} /* drawScoreBoard */
|
||||||
|
|
||||||
|
|
|
@ -55,8 +55,8 @@ enum {
|
||||||
typedef XP_U8 GameEndReason;
|
typedef XP_U8 GameEndReason;
|
||||||
|
|
||||||
typedef struct ServerPlayer {
|
typedef struct ServerPlayer {
|
||||||
EngineCtxt* engine; /* each needs his own so don't interfere each other */
|
EngineCtxt* engine; /* each needs his own so don't interfere each other */
|
||||||
XP_S8 deviceIndex; /* 0 means local, -1 means unknown */
|
XP_S8 deviceIndex; /* 0 means local, -1 means unknown */
|
||||||
} ServerPlayer;
|
} ServerPlayer;
|
||||||
|
|
||||||
#define UNKNOWN_DEVICE -1
|
#define UNKNOWN_DEVICE -1
|
||||||
|
@ -87,7 +87,7 @@ typedef struct ServerVolatiles {
|
||||||
typedef struct ServerNonvolatiles {
|
typedef struct ServerNonvolatiles {
|
||||||
XP_U8 nDevices;
|
XP_U8 nDevices;
|
||||||
XW_State gameState;
|
XW_State gameState;
|
||||||
XP_S8 currentTurn; /* invalid when game is over */
|
XP_S8 currentTurn; /* invalid when game is over */
|
||||||
XP_U8 pendingRegistrations;
|
XP_U8 pendingRegistrations;
|
||||||
XP_Bool showRobotScores;
|
XP_Bool showRobotScores;
|
||||||
|
|
||||||
|
@ -201,12 +201,12 @@ initServer( ServerCtxt* server )
|
||||||
if ( !lp->isLocal/* && !lp->name */ ) {
|
if ( !lp->isLocal/* && !lp->name */ ) {
|
||||||
++server->nv.pendingRegistrations;
|
++server->nv.pendingRegistrations;
|
||||||
}
|
}
|
||||||
|
|
||||||
player->deviceIndex = lp->isLocal? SERVER_DEVICE : UNKNOWN_DEVICE;
|
player->deviceIndex = lp->isLocal? SERVER_DEVICE : UNKNOWN_DEVICE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
server->nv.nDevices = 1; /* local device (0) is always there */
|
server->nv.nDevices = 1; /* local device (0) is always there */
|
||||||
} /* initServer */
|
} /* initServer */
|
||||||
|
|
||||||
ServerCtxt*
|
ServerCtxt*
|
||||||
|
@ -249,7 +249,8 @@ getNV( XWStreamCtxt* stream, ServerNonvolatiles* nv, XP_U16 nPlayers )
|
||||||
nv->pendingRegistrations = (XP_U8)stream_getBits( stream, NPLAYERS_NBITS );
|
nv->pendingRegistrations = (XP_U8)stream_getBits( stream, NPLAYERS_NBITS );
|
||||||
|
|
||||||
for ( i = 0; i < nPlayers; ++i ) {
|
for ( i = 0; i < nPlayers; ++i ) {
|
||||||
nv->addresses[i].channelNo = (XP_PlayerAddr)stream_getBits( stream, 16 );
|
nv->addresses[i].channelNo = (XP_PlayerAddr)stream_getBits( stream,
|
||||||
|
16 );
|
||||||
}
|
}
|
||||||
} /* getNV */
|
} /* getNV */
|
||||||
|
|
||||||
|
@ -517,7 +518,7 @@ robotTradeTiles( ServerCtxt* server, MoveInfo* newMove )
|
||||||
XP_U16 numInTray = model_getNumPlayerTiles( server->model, turn );
|
XP_U16 numInTray = model_getNumPlayerTiles( server->model, turn );
|
||||||
XP_MEMCPY( tradeTiles, curTiles, numInTray );
|
XP_MEMCPY( tradeTiles, curTiles, numInTray );
|
||||||
|
|
||||||
for ( i = 0; i < numInTray; ++i ) { /* for each tile in tray */
|
for ( i = 0; i < numInTray; ++i ) { /* for each tile in tray */
|
||||||
XP_Bool keep = XP_FALSE;
|
XP_Bool keep = XP_FALSE;
|
||||||
for ( j = 0; j < newMove->numTiles; ++j ) { /* for each in move */
|
for ( j = 0; j < newMove->numTiles; ++j ) { /* for each in move */
|
||||||
Tile movedTile = newMove->tiles[j].tile;
|
Tile movedTile = newMove->tiles[j].tile;
|
||||||
|
@ -599,7 +600,7 @@ makeRobotMove( ServerCtxt* server )
|
||||||
CurGameInfo* gi = server->vol.gi;
|
CurGameInfo* gi = server->vol.gi;
|
||||||
XP_Bool timerEnabled = gi->timerEnabled;
|
XP_Bool timerEnabled = gi->timerEnabled;
|
||||||
XP_Bool canMove;
|
XP_Bool canMove;
|
||||||
XP_U32 time = 0L; /* stupid compiler.... */
|
XP_U32 time = 0L; /* stupid compiler.... */
|
||||||
XP_U16 targetScore = NO_SCORE_LIMIT;
|
XP_U16 targetScore = NO_SCORE_LIMIT;
|
||||||
XW_UtilCtxt* util = server->vol.util;
|
XW_UtilCtxt* util = server->vol.util;
|
||||||
|
|
||||||
|
@ -685,7 +686,7 @@ makeRobotMove( ServerCtxt* server )
|
||||||
XP_ASSERT( gi->players[turn].secondsUsed == 0 );
|
XP_ASSERT( gi->players[turn].secondsUsed == 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
return result; /* always return TRUE after robot move? */
|
return result; /* always return TRUE after robot move? */
|
||||||
} /* makeRobotMove */
|
} /* makeRobotMove */
|
||||||
|
|
||||||
static XP_Bool
|
static XP_Bool
|
||||||
|
@ -764,7 +765,7 @@ server_do( ServerCtxt* server )
|
||||||
server->serverDoing = XP_TRUE;
|
server->serverDoing = XP_TRUE;
|
||||||
|
|
||||||
switch( server->nv.gameState ) {
|
switch( server->nv.gameState ) {
|
||||||
case XWSTATE_BEGIN:
|
case XWSTATE_BEGIN:
|
||||||
if ( server->nv.pendingRegistrations == 0 ) { /* all players on device */
|
if ( server->nv.pendingRegistrations == 0 ) { /* all players on device */
|
||||||
assignTilesToAll( server );
|
assignTilesToAll( server );
|
||||||
SETSTATE( server, XWSTATE_INTURN );
|
SETSTATE( server, XWSTATE_INTURN );
|
||||||
|
@ -1010,7 +1011,7 @@ client_readInitialMessage( ServerCtxt* server, XWStreamCtxt* stream )
|
||||||
dict_destroy( newDict );
|
dict_destroy( newDict );
|
||||||
} else {
|
} else {
|
||||||
dict_destroy( curDict );
|
dict_destroy( curDict );
|
||||||
model_setDictionary( model, newDict );
|
model_setDictionary( model, newDict );
|
||||||
util_userError( server->vol.util, ERR_SERVER_DICT_WINS );
|
util_userError( server->vol.util, ERR_SERVER_DICT_WINS );
|
||||||
clearLocalRobots( server );
|
clearLocalRobots( server );
|
||||||
}
|
}
|
||||||
|
@ -1759,7 +1760,7 @@ reflectMoveAndInform( ServerCtxt* server, XWStreamCtxt* stream )
|
||||||
{
|
{
|
||||||
ModelCtxt* model = server->vol.model;
|
ModelCtxt* model = server->vol.model;
|
||||||
XP_U16 whoMoved;
|
XP_U16 whoMoved;
|
||||||
XP_U16 nTilesMoved = 0; /* trade case */
|
XP_U16 nTilesMoved = 0; /* trade case */
|
||||||
XP_Bool isTrade;
|
XP_Bool isTrade;
|
||||||
XP_Bool isLegalMove;
|
XP_Bool isLegalMove;
|
||||||
XP_Bool doRequest = XP_FALSE;
|
XP_Bool doRequest = XP_FALSE;
|
||||||
|
@ -1774,7 +1775,7 @@ reflectMoveAndInform( ServerCtxt* server, XWStreamCtxt* stream )
|
||||||
|
|
||||||
readMoveInfo( server, stream, &whoMoved, &isTrade, &newTiles,
|
readMoveInfo( server, stream, &whoMoved, &isTrade, &newTiles,
|
||||||
&tradedTiles, &isLegalMove ); /* modifies model */
|
&tradedTiles, &isLegalMove ); /* modifies model */
|
||||||
XP_ASSERT( isLegalMove ); /* client should always report as true */
|
XP_ASSERT( isLegalMove ); /* client should always report as true */
|
||||||
isLegalMove = XP_TRUE;
|
isLegalMove = XP_TRUE;
|
||||||
|
|
||||||
if ( isTrade ) {
|
if ( isTrade ) {
|
||||||
|
@ -1825,7 +1826,7 @@ reflectMoveAndInform( ServerCtxt* server, XWStreamCtxt* stream )
|
||||||
XP_ASSERT( !server->vol.prevMoveStream );
|
XP_ASSERT( !server->vol.prevMoveStream );
|
||||||
server->vol.prevMoveStream = mvStream;
|
server->vol.prevMoveStream = mvStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/* The client from which the move came still needs to be told. But we
|
/* The client from which the move came still needs to be told. But we
|
||||||
can't send a message now since we're burried in a message handler.
|
can't send a message now since we're burried in a message handler.
|
||||||
|
@ -2209,7 +2210,7 @@ reflectUndos( ServerCtxt* server, XWStreamCtxt* stream, XW_Proto code )
|
||||||
if ( code == XWPROTO_UNDO_INFO_CLIENT ) { /* need to inform */
|
if ( code == XWPROTO_UNDO_INFO_CLIENT ) { /* need to inform */
|
||||||
XP_U16 sourceClientIndex =
|
XP_U16 sourceClientIndex =
|
||||||
getIndexForDevice( server, stream_getAddress( stream ) );
|
getIndexForDevice( server, stream_getAddress( stream ) );
|
||||||
|
|
||||||
sendUndoToClientsExcept( server, sourceClientIndex, nUndone,
|
sendUndoToClientsExcept( server, sourceClientIndex, nUndone,
|
||||||
lastUndone );
|
lastUndone );
|
||||||
|
|
||||||
|
@ -2225,7 +2226,7 @@ XP_Bool
|
||||||
server_handleUndo( ServerCtxt* server )
|
server_handleUndo( ServerCtxt* server )
|
||||||
{
|
{
|
||||||
XP_Bool result = XP_FALSE;
|
XP_Bool result = XP_FALSE;
|
||||||
XP_U16 lastTurnUndone = 0; /* quiet compiler good */
|
XP_U16 lastTurnUndone = 0; /* quiet compiler good */
|
||||||
XP_U16 nUndone = 0;
|
XP_U16 nUndone = 0;
|
||||||
ModelCtxt* model;
|
ModelCtxt* model;
|
||||||
CurGameInfo* gi;
|
CurGameInfo* gi;
|
||||||
|
@ -2240,7 +2241,7 @@ server_handleUndo( ServerCtxt* server )
|
||||||
The exception is that if the first move was a robot move we'll stop
|
The exception is that if the first move was a robot move we'll stop
|
||||||
there, and it will immediately move again. */
|
there, and it will immediately move again. */
|
||||||
for ( ; ; ) {
|
for ( ; ; ) {
|
||||||
XP_S16 moveNum = -1; /* don't need it checked */
|
XP_S16 moveNum = -1; /* don't need it checked */
|
||||||
if ( !model_undoLatestMoves( model, server->pool, 1, &lastTurnUndone,
|
if ( !model_undoLatestMoves( model, server->pool, 1, &lastTurnUndone,
|
||||||
&moveNum ) ) {
|
&moveNum ) ) {
|
||||||
break;
|
break;
|
||||||
|
@ -2297,28 +2298,28 @@ server_receiveMessage( ServerCtxt* server, XWStreamCtxt* incoming )
|
||||||
XP_STATUSF( "client got XWPROTO_CLIENT_SETUP" );
|
XP_STATUSF( "client got XWPROTO_CLIENT_SETUP" );
|
||||||
XP_ASSERT( server->vol.gi->serverRole == SERVER_ISCLIENT );
|
XP_ASSERT( server->vol.gi->serverRole == SERVER_ISCLIENT );
|
||||||
accepted = client_readInitialMessage( server, incoming );
|
accepted = client_readInitialMessage( server, incoming );
|
||||||
|
|
||||||
} else if ( readStreamHeader( server, incoming ) ) {
|
} else if ( readStreamHeader( server, incoming ) ) {
|
||||||
|
|
||||||
switch( code ) {
|
switch( code ) {
|
||||||
/* case XWPROTO_MOVEMADE_INFO: */
|
/* case XWPROTO_MOVEMADE_INFO: */
|
||||||
/* accepted = client_reflectMoveMade( server, incoming ); */
|
/* accepted = client_reflectMoveMade( server, incoming ); */
|
||||||
/* if ( accepted ) { */
|
/* if ( accepted ) { */
|
||||||
/* nextTurn( server ); */
|
/* nextTurn( server ); */
|
||||||
/* } */
|
/* } */
|
||||||
/* break; */
|
/* break; */
|
||||||
/* case XWPROTO_TRADEMADE_INFO: */
|
/* case XWPROTO_TRADEMADE_INFO: */
|
||||||
/* accepted = client_reflectTradeMade( server, incoming ); */
|
/* accepted = client_reflectTradeMade( server, incoming ); */
|
||||||
/* if ( accepted ) { */
|
/* if ( accepted ) { */
|
||||||
/* nextTurn( server ); */
|
/* nextTurn( server ); */
|
||||||
/* } */
|
/* } */
|
||||||
/* break; */
|
/* break; */
|
||||||
/* case XWPROTO_CLIENT_MOVE_INFO: */
|
/* case XWPROTO_CLIENT_MOVE_INFO: */
|
||||||
/* accepted = handleClientMoved( server, incoming ); */
|
/* accepted = handleClientMoved( server, incoming ); */
|
||||||
/* break; */
|
/* break; */
|
||||||
/* case XWPROTO_CLIENT_TRADE_INFO: */
|
/* case XWPROTO_CLIENT_TRADE_INFO: */
|
||||||
/* accepted = handleClientTraded( server, incoming ); */
|
/* accepted = handleClientTraded( server, incoming ); */
|
||||||
/* break; */
|
/* break; */
|
||||||
|
|
||||||
case XWPROTO_MOVEMADE_INFO_CLIENT: /* client is reporting a move */
|
case XWPROTO_MOVEMADE_INFO_CLIENT: /* client is reporting a move */
|
||||||
accepted = (XWSTATE_INTURN == server->nv.gameState)
|
accepted = (XWSTATE_INTURN == server->nv.gameState)
|
||||||
|
@ -2432,7 +2433,7 @@ server_formatRemainingTiles( ServerCtxt* server, XWStreamCtxt* stream,
|
||||||
PoolContext* pool = server->pool;
|
PoolContext* pool = server->pool;
|
||||||
|
|
||||||
if ( !pool ) {
|
if ( !pool ) {
|
||||||
return; /* might want to print an explanation in the stream */
|
return; /* might want to print an explanation in the stream */
|
||||||
}
|
}
|
||||||
|
|
||||||
XP_ASSERT( !!server->vol.model );
|
XP_ASSERT( !!server->vol.model );
|
||||||
|
@ -2509,7 +2510,7 @@ server_writeFinalScores( ServerCtxt* server, XWStreamCtxt* stream )
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( highestIndex == -1 ) {
|
if ( highestIndex == -1 ) {
|
||||||
break; /* we're done */
|
break; /* we're done */
|
||||||
} else if ( place > 1 ) {
|
} else if ( place > 1 ) {
|
||||||
stream_putString( stream, XP_CR );
|
stream_putString( stream, XP_CR );
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#ifndef _SERVER_H_
|
#ifndef _SERVER_H_
|
||||||
#define _SERVER_H_
|
#define _SERVER_H_
|
||||||
|
|
||||||
#include "comtypes.h" /* that's *common* types */
|
#include "comtypes.h" /* that's *common* types */
|
||||||
|
|
||||||
#include "commmgr.h"
|
#include "commmgr.h"
|
||||||
#include "model.h"
|
#include "model.h"
|
||||||
|
@ -49,7 +49,7 @@ typedef XP_U8 DeviceRole;
|
||||||
/* typedef struct ServerVtable { */
|
/* typedef struct ServerVtable { */
|
||||||
|
|
||||||
/* void (*m_registerPlayer)( ServerCtxt* server, XP_U16 playerNum, */
|
/* void (*m_registerPlayer)( ServerCtxt* server, XP_U16 playerNum, */
|
||||||
/* XP_PlayerSocket socket ); */
|
/* XP_PlayerSocket socket ); */
|
||||||
|
|
||||||
/* void (*m_getTileValueInfo)( ServerCtxt* server, void* valueBuf ); */
|
/* void (*m_getTileValueInfo)( ServerCtxt* server, void* valueBuf ); */
|
||||||
|
|
||||||
|
|
|
@ -28,11 +28,11 @@ typedef enum {
|
||||||
XWSTATE_NONE,
|
XWSTATE_NONE,
|
||||||
XWSTATE_BEGIN,
|
XWSTATE_BEGIN,
|
||||||
__UNUSED1, /*XWSTATE_POOL_INITED,*/
|
__UNUSED1, /*XWSTATE_POOL_INITED,*/
|
||||||
XWSTATE_NEED_SHOWSCORE, /* client-only */
|
XWSTATE_NEED_SHOWSCORE, /* client-only */
|
||||||
XWSTATE_WAITING_ALL_REG, /* includes waiting for dict from server */
|
XWSTATE_WAITING_ALL_REG, /* includes waiting for dict from server */
|
||||||
XWSTATE_RECEIVED_ALL_REG, /* includes waiting for dict from server */
|
XWSTATE_RECEIVED_ALL_REG, /* includes waiting for dict from server */
|
||||||
XWSTATE_NEEDSEND_BADWORD_INFO,
|
XWSTATE_NEEDSEND_BADWORD_INFO,
|
||||||
XWSTATE_MOVE_CONFIRM_WAIT, /* client's waiting to hear back */
|
XWSTATE_MOVE_CONFIRM_WAIT, /* client's waiting to hear back */
|
||||||
XWSTATE_MOVE_CONFIRM_MUSTSEND, /* server should tell client asap */
|
XWSTATE_MOVE_CONFIRM_MUSTSEND, /* server should tell client asap */
|
||||||
XWSTATE_NEEDSEND_ENDGAME,
|
XWSTATE_NEEDSEND_ENDGAME,
|
||||||
XWSTATE_INTURN,
|
XWSTATE_INTURN,
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define TILE_NBITS 6 /* 32 tiles plus the blank */
|
#define TILE_NBITS 6 /* 32 tiles plus the blank */
|
||||||
|
|
||||||
XP_U16 bitsForMax( XP_U32 n );
|
XP_U16 bitsForMax( XP_U32 n );
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ trayLocToIndex( BoardCtxt* board, XP_U16 loc )
|
||||||
XP_S16
|
XP_S16
|
||||||
pointToTileIndex( BoardCtxt* board, XP_U16 x, XP_U16 y, XP_Bool* onDividerP )
|
pointToTileIndex( BoardCtxt* board, XP_U16 x, XP_U16 y, XP_Bool* onDividerP )
|
||||||
{
|
{
|
||||||
XP_S16 result = -1; /* not on a tile */
|
XP_S16 result = -1; /* not on a tile */
|
||||||
XP_Rect divider;
|
XP_Rect divider;
|
||||||
XP_Rect biggerRect;
|
XP_Rect biggerRect;
|
||||||
XP_Bool onDivider;
|
XP_Bool onDivider;
|
||||||
|
@ -392,7 +392,7 @@ handleActionInTray( BoardCtxt* board, XP_S16 index, XP_Bool onDivider )
|
||||||
}
|
}
|
||||||
} else if ( index == -(MAX_TRAY_TILES) ) { /* pending score tile */
|
} else if ( index == -(MAX_TRAY_TILES) ) { /* pending score tile */
|
||||||
result = board_commitTurn( board );
|
result = board_commitTurn( board );
|
||||||
} else if ( index < 0 ) { /* other empty area */
|
} else if ( index < 0 ) { /* other empty area */
|
||||||
/* it better be true */
|
/* it better be true */
|
||||||
(void)board_replaceTiles( board );
|
(void)board_replaceTiles( board );
|
||||||
result = XP_TRUE;
|
result = XP_TRUE;
|
||||||
|
@ -414,7 +414,7 @@ indexForBits( XP_U8 bits )
|
||||||
XP_U16 result = 0;
|
XP_U16 result = 0;
|
||||||
XP_U16 mask = 1;
|
XP_U16 mask = 1;
|
||||||
|
|
||||||
XP_ASSERT( bits != 0 ); /* otherwise loops forever */
|
XP_ASSERT( bits != 0 ); /* otherwise loops forever */
|
||||||
|
|
||||||
while ( (mask & bits) == 0 ) {
|
while ( (mask & bits) == 0 ) {
|
||||||
++result;
|
++result;
|
||||||
|
|
|
@ -46,8 +46,8 @@ typedef enum {
|
||||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
#ifndef XWFEATURE_STANDALONE_ONLY
|
||||||
ERR_SERVER_DICT_WINS,
|
ERR_SERVER_DICT_WINS,
|
||||||
ERR_NO_PEEK_REMOTE_TILES,
|
ERR_NO_PEEK_REMOTE_TILES,
|
||||||
ERR_REG_UNEXPECTED_USER, /* server asked to register too many remote
|
ERR_REG_UNEXPECTED_USER, /* server asked to register too many remote
|
||||||
users */
|
users */
|
||||||
ERR_REG_SERVER_SANS_REMOTE,
|
ERR_REG_SERVER_SANS_REMOTE,
|
||||||
STR_NEED_BT_HOST_ADDR,
|
STR_NEED_BT_HOST_ADDR,
|
||||||
#endif
|
#endif
|
||||||
|
@ -62,7 +62,7 @@ typedef enum {
|
||||||
} UtilErrID;
|
} UtilErrID;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
QUERY_COMMIT_TURN, /* 0 means cancel; 1 means commit */
|
QUERY_COMMIT_TURN, /* 0 means cancel; 1 means commit */
|
||||||
QUERY_COMMIT_TRADE,
|
QUERY_COMMIT_TRADE,
|
||||||
QUERY_ROBOT_MOVE,
|
QUERY_ROBOT_MOVE,
|
||||||
QUERY_ROBOT_TRADE,
|
QUERY_ROBOT_TRADE,
|
||||||
|
|
|
@ -26,7 +26,7 @@ enum {
|
||||||
VIRTUAL_UTIL,
|
VIRTUAL_UTIL,
|
||||||
VIRTUAL_DRAW,
|
VIRTUAL_DRAW,
|
||||||
VIRTUAL_STREAM,
|
VIRTUAL_STREAM,
|
||||||
VIRTUAL_NUM_VIRTUALS /* must be last */
|
VIRTUAL_NUM_VIRTUALS /* must be last */
|
||||||
} XW_VIRTUALS;
|
} XW_VIRTUALS;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -46,10 +46,10 @@ vtmgr_destroy( MPFORMAL VTableMgr* vtmgr )
|
||||||
XP_ASSERT( !!vtmgr );
|
XP_ASSERT( !!vtmgr );
|
||||||
|
|
||||||
for ( i = 0; i < VTABLE_NUM_SLOTS; ++i ) {
|
for ( i = 0; i < VTABLE_NUM_SLOTS; ++i ) {
|
||||||
void* vtable = vtmgr->slots[i];
|
void* vtable = vtmgr->slots[i];
|
||||||
if ( !!vtable ) {
|
if ( !!vtable ) {
|
||||||
XP_FREE( mpool, vtable );
|
XP_FREE( mpool, vtable );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
XP_FREE( mpool, vtmgr );
|
XP_FREE( mpool, vtmgr );
|
||||||
|
|
|
@ -24,26 +24,26 @@
|
||||||
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
XWPROTO_ERROR = 0, /* illegal value */
|
XWPROTO_ERROR = 0, /* illegal value */
|
||||||
XWPROTO_CHAT, /* reserved... */
|
XWPROTO_CHAT, /* reserved... */
|
||||||
XWPROTO_DEVICE_REGISTRATION, /* client's first message to server */
|
XWPROTO_DEVICE_REGISTRATION, /* client's first message to server */
|
||||||
XWPROTO_CLIENT_SETUP, /* server's first message to client */
|
XWPROTO_CLIENT_SETUP, /* server's first message to client */
|
||||||
XWPROTO_MOVEMADE_INFO_CLIENT, /* client reports a move it made */
|
XWPROTO_MOVEMADE_INFO_CLIENT, /* client reports a move it made */
|
||||||
XWPROTO_MOVEMADE_INFO_SERVER, /* server tells all clients about a move
|
XWPROTO_MOVEMADE_INFO_SERVER, /* server tells all clients about a move
|
||||||
made by it or another client */
|
made by it or another client */
|
||||||
XWPROTO_UNDO_INFO_CLIENT, /* client reports undo[s] on the device */
|
XWPROTO_UNDO_INFO_CLIENT, /* client reports undo[s] on the device */
|
||||||
XWPROTO_UNDO_INFO_SERVER, /* server reports undos[s] happening
|
XWPROTO_UNDO_INFO_SERVER, /* server reports undos[s] happening
|
||||||
elsewhere*/
|
elsewhere*/
|
||||||
//XWPROTO_CLIENT_MOVE_INFO, /* client says "I made this move" */
|
//XWPROTO_CLIENT_MOVE_INFO, /* client says "I made this move" */
|
||||||
//XWPROTO_SERVER_MOVE_INFO, /* server says "Player X made this move" */
|
//XWPROTO_SERVER_MOVE_INFO, /* server says "Player X made this move" */
|
||||||
/* XWPROTO_CLIENT_TRADE_INFO, */
|
/* XWPROTO_CLIENT_TRADE_INFO, */
|
||||||
/* XWPROTO_TRADEMADE_INFO, */
|
/* XWPROTO_TRADEMADE_INFO, */
|
||||||
XWPROTO_BADWORD_INFO,
|
XWPROTO_BADWORD_INFO,
|
||||||
XWPROTO_MOVE_CONFIRM, /* server tells move sender that move was
|
XWPROTO_MOVE_CONFIRM, /* server tells move sender that move was
|
||||||
legal */
|
legal */
|
||||||
//XWPROTO_MOVEMADE_INFO, /* info about tiles placed and received */
|
//XWPROTO_MOVEMADE_INFO, /* info about tiles placed and received */
|
||||||
XWPROTO_CLIENT_REQ_END_GAME, /* non-server wants to end the game */
|
XWPROTO_CLIENT_REQ_END_GAME, /* non-server wants to end the game */
|
||||||
XWPROTO_END_GAME /* server says to end game */
|
XWPROTO_END_GAME /* server says to end game */
|
||||||
|
|
||||||
|
|
||||||
} XW_Proto;
|
} XW_Proto;
|
||||||
|
|
|
@ -71,7 +71,7 @@ typedef struct StreamCtxVTable {
|
||||||
XP_U16 (*m_stream_getSize)( XWStreamCtxt* dctx );
|
XP_U16 (*m_stream_getSize)( XWStreamCtxt* dctx );
|
||||||
|
|
||||||
/* void (*m_stream_makeReturnAddr)( XWStreamCtxt* dctx, XP_PlayerAddr* addr, */
|
/* void (*m_stream_makeReturnAddr)( XWStreamCtxt* dctx, XP_PlayerAddr* addr, */
|
||||||
/* XP_U16* addrLen ); */
|
/* XP_U16* addrLen ); */
|
||||||
|
|
||||||
XP_PlayerAddr (*m_stream_getAddress)( XWStreamCtxt* dctx );
|
XP_PlayerAddr (*m_stream_getAddress)( XWStreamCtxt* dctx );
|
||||||
void (*m_stream_setAddress)( XWStreamCtxt* dctx, XP_PlayerAddr channelNo );
|
void (*m_stream_setAddress)( XWStreamCtxt* dctx, XP_PlayerAddr channelNo );
|
||||||
|
|
Loading…
Reference in a new issue