mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-28 09:58:30 +01:00
add some consts.
This commit is contained in:
parent
6c81a63fce
commit
ebad668227
9 changed files with 59 additions and 54 deletions
|
@ -60,8 +60,8 @@ typedef XP_U32 CrossBits;
|
||||||
typedef struct Crosscheck { CrossBits bits[2]; } Crosscheck;
|
typedef struct Crosscheck { CrossBits bits[2]; } Crosscheck;
|
||||||
|
|
||||||
struct EngineCtxt {
|
struct EngineCtxt {
|
||||||
ModelCtxt* model;
|
const ModelCtxt* model;
|
||||||
DictionaryCtxt* dict;
|
const DictionaryCtxt* dict;
|
||||||
XW_UtilCtxt* util;
|
XW_UtilCtxt* util;
|
||||||
|
|
||||||
Engine_rack rack;
|
Engine_rack rack;
|
||||||
|
@ -99,7 +99,8 @@ struct EngineCtxt {
|
||||||
static void findMovesOneRow( EngineCtxt* engine );
|
static void findMovesOneRow( EngineCtxt* engine );
|
||||||
static Tile localGetBoardTile( EngineCtxt* engine, XP_U16 col,
|
static Tile localGetBoardTile( EngineCtxt* engine, XP_U16 col,
|
||||||
XP_U16 row, XP_Bool substBlank );
|
XP_U16 row, XP_Bool substBlank );
|
||||||
static array_edge* edge_with_tile( DictionaryCtxt* dict, array_edge* from, Tile tile );
|
static array_edge* edge_with_tile( const DictionaryCtxt* dict,
|
||||||
|
array_edge* from, Tile tile );
|
||||||
static XP_Bool scoreQualifies( EngineCtxt* engine, XP_U16 score );
|
static XP_Bool scoreQualifies( EngineCtxt* engine, XP_U16 score );
|
||||||
static void findMovesForAnchor( EngineCtxt* engine, XP_S16* prevAnchor,
|
static void findMovesForAnchor( EngineCtxt* engine, XP_S16* prevAnchor,
|
||||||
XP_U16 col, XP_U16 row ) ;
|
XP_U16 col, XP_U16 row ) ;
|
||||||
|
@ -107,9 +108,9 @@ static void figureCrosschecks( EngineCtxt* engine, XP_U16 col,
|
||||||
XP_U16 row, XP_U16* scoreP,
|
XP_U16 row, XP_U16* scoreP,
|
||||||
Crosscheck* check );
|
Crosscheck* check );
|
||||||
static XP_Bool isAnchorSquare( EngineCtxt* engine, XP_U16 col, XP_U16 row );
|
static XP_Bool isAnchorSquare( EngineCtxt* engine, XP_U16 col, XP_U16 row );
|
||||||
static array_edge* follow( DictionaryCtxt* dict, array_edge* in );
|
static array_edge* follow( const DictionaryCtxt* dict, array_edge* in );
|
||||||
static array_edge* edge_from_tile( DictionaryCtxt* dict, array_edge* from,
|
static array_edge* edge_from_tile( const DictionaryCtxt* dict,
|
||||||
Tile tile );
|
array_edge* from, Tile tile );
|
||||||
static void leftPart( EngineCtxt* engine, Tile* tiles, XP_U16 tileLength,
|
static void leftPart( EngineCtxt* engine, Tile* tiles, XP_U16 tileLength,
|
||||||
array_edge* edge, XP_U16 limit, XP_U16 firstCol,
|
array_edge* edge, XP_U16 limit, XP_U16 firstCol,
|
||||||
XP_U16 anchorCol, XP_U16 row );
|
XP_U16 anchorCol, XP_U16 row );
|
||||||
|
@ -379,8 +380,8 @@ chooseMove( EngineCtxt* engine, PossibleMove** move )
|
||||||
* filled in in *newMove.
|
* filled in in *newMove.
|
||||||
*/
|
*/
|
||||||
XP_Bool
|
XP_Bool
|
||||||
engine_findMove( EngineCtxt* engine, ModelCtxt* model,
|
engine_findMove( EngineCtxt* engine, const ModelCtxt* model,
|
||||||
DictionaryCtxt* dict, const Tile* tiles,
|
const DictionaryCtxt* dict, const Tile* tiles,
|
||||||
XP_U16 nTiles,
|
XP_U16 nTiles,
|
||||||
#ifdef XWFEATURE_SEARCHLIMIT
|
#ifdef XWFEATURE_SEARCHLIMIT
|
||||||
BdHintLimits* searchLimits,
|
BdHintLimits* searchLimits,
|
||||||
|
@ -579,8 +580,8 @@ findMovesOneRow( EngineCtxt* engine )
|
||||||
} /* findMovesOneRow */
|
} /* findMovesOneRow */
|
||||||
|
|
||||||
static XP_Bool
|
static XP_Bool
|
||||||
lookup( DictionaryCtxt* dict, array_edge* edge, Tile* buf, XP_U16 tileIndex,
|
lookup( const DictionaryCtxt* dict, array_edge* edge, Tile* buf,
|
||||||
XP_U16 length )
|
XP_U16 tileIndex, XP_U16 length )
|
||||||
{
|
{
|
||||||
while ( edge != NULL ) {
|
while ( edge != NULL ) {
|
||||||
Tile targetTile = buf[tileIndex];
|
Tile targetTile = buf[tileIndex];
|
||||||
|
@ -611,7 +612,7 @@ figureCrosschecks( EngineCtxt* engine, XP_U16 x, XP_U16 y, XP_U16* scoreP,
|
||||||
Tile tiles[MAX_COLS];
|
Tile tiles[MAX_COLS];
|
||||||
XP_U16 tilesAfter;
|
XP_U16 tilesAfter;
|
||||||
XP_U16 checkScore = 0;
|
XP_U16 checkScore = 0;
|
||||||
DictionaryCtxt* dict = engine->dict;
|
const DictionaryCtxt* dict = engine->dict;
|
||||||
|
|
||||||
if ( localGetBoardTile( engine, x, y, XP_FALSE ) == EMPTY_TILE ) {
|
if ( localGetBoardTile( engine, x, y, XP_FALSE ) == EMPTY_TILE ) {
|
||||||
|
|
||||||
|
@ -802,7 +803,6 @@ findMovesForAnchor( EngineCtxt* engine, XP_S16* prevAnchor,
|
||||||
array_edge* edge;
|
array_edge* edge;
|
||||||
array_edge* topEdge;
|
array_edge* topEdge;
|
||||||
Tile tiles[MAX_ROWS];
|
Tile tiles[MAX_ROWS];
|
||||||
XP_S16 tileLength = 0;
|
|
||||||
|
|
||||||
hiliteForAnchor( engine, col, row );
|
hiliteForAnchor( engine, col, row );
|
||||||
|
|
||||||
|
@ -826,7 +826,7 @@ findMovesForAnchor( EngineCtxt* engine, XP_S16* prevAnchor,
|
||||||
edge = consumeFromLeft( engine, topEdge, col, row );
|
edge = consumeFromLeft( engine, topEdge, col, row );
|
||||||
}
|
}
|
||||||
DEBUG_ASSIGN(engine->curLimit, 0);
|
DEBUG_ASSIGN(engine->curLimit, 0);
|
||||||
extendRight( engine, tiles, tileLength, edge,
|
extendRight( engine, tiles, 0, edge,
|
||||||
XP_FALSE, // can't accept without the anchor square
|
XP_FALSE, // can't accept without the anchor square
|
||||||
col-limit, col, row );
|
col-limit, col, row );
|
||||||
|
|
||||||
|
@ -914,7 +914,7 @@ extendRight( EngineCtxt* engine, Tile* tiles, XP_U16 tileLength,
|
||||||
XP_U16 firstCol, XP_U16 col, XP_U16 row )
|
XP_U16 firstCol, XP_U16 col, XP_U16 row )
|
||||||
{
|
{
|
||||||
Tile tile;
|
Tile tile;
|
||||||
DictionaryCtxt* dict = engine->dict;
|
const DictionaryCtxt* dict = engine->dict;
|
||||||
|
|
||||||
if ( col == engine->numCols ) { /* we're off the board */
|
if ( col == engine->numCols ) { /* we're off the board */
|
||||||
goto check_exit;
|
goto check_exit;
|
||||||
|
@ -1208,7 +1208,7 @@ scoreQualifies( EngineCtxt* engine, XP_U16 score )
|
||||||
} /* scoreQualifies */
|
} /* scoreQualifies */
|
||||||
|
|
||||||
static array_edge*
|
static array_edge*
|
||||||
edge_with_tile( DictionaryCtxt* dict, array_edge* from, Tile tile )
|
edge_with_tile( const DictionaryCtxt* dict, array_edge* from, Tile tile )
|
||||||
{
|
{
|
||||||
for ( ; ; ) {
|
for ( ; ; ) {
|
||||||
Tile candidate = EDGETILE(dict,from);
|
Tile candidate = EDGETILE(dict,from);
|
||||||
|
@ -1232,7 +1232,7 @@ edge_with_tile( DictionaryCtxt* dict, array_edge* from, Tile tile )
|
||||||
} /* edge_with_tile */
|
} /* edge_with_tile */
|
||||||
|
|
||||||
static unsigned long
|
static unsigned long
|
||||||
index_from( DictionaryCtxt* dict, array_edge* p_edge )
|
index_from( const DictionaryCtxt* dict, array_edge* p_edge )
|
||||||
{
|
{
|
||||||
unsigned long result;
|
unsigned long result;
|
||||||
|
|
||||||
|
@ -1260,7 +1260,7 @@ index_from( DictionaryCtxt* dict, array_edge* p_edge )
|
||||||
} /* index_from */
|
} /* index_from */
|
||||||
|
|
||||||
static array_edge*
|
static array_edge*
|
||||||
follow( DictionaryCtxt* dict, array_edge* in )
|
follow( const DictionaryCtxt* dict, array_edge* in )
|
||||||
{
|
{
|
||||||
XP_U32 index = index_from( dict, in );
|
XP_U32 index = index_from( dict, in );
|
||||||
array_edge* result = index > 0?
|
array_edge* result = index > 0?
|
||||||
|
@ -1269,7 +1269,7 @@ follow( DictionaryCtxt* dict, array_edge* in )
|
||||||
} /* follow */
|
} /* follow */
|
||||||
|
|
||||||
static array_edge*
|
static array_edge*
|
||||||
edge_from_tile( DictionaryCtxt* dict, array_edge* from, Tile tile )
|
edge_from_tile( const DictionaryCtxt* dict, array_edge* from, Tile tile )
|
||||||
{
|
{
|
||||||
array_edge* edge = edge_with_tile( dict, from, tile );
|
array_edge* edge = edge_with_tile( dict, from, tile );
|
||||||
if ( edge != NULL ) {
|
if ( edge != NULL ) {
|
||||||
|
|
|
@ -49,8 +49,8 @@ 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, ModelCtxt* model,
|
XP_Bool engine_findMove( EngineCtxt* ctxt, const ModelCtxt* model,
|
||||||
DictionaryCtxt* dict, const Tile* tiles,
|
const DictionaryCtxt* dict, const Tile* tiles,
|
||||||
XP_U16 nTiles,
|
XP_U16 nTiles,
|
||||||
#ifdef XWFEATURE_SEARCHLIMIT
|
#ifdef XWFEATURE_SEARCHLIMIT
|
||||||
BdHintLimits* boardLimits,
|
BdHintLimits* boardLimits,
|
||||||
|
|
|
@ -50,7 +50,8 @@ static void notifyBoardListeners( ModelCtxt* model, XP_U16 turn,
|
||||||
XP_U16 col, XP_U16 row, XP_Bool added );
|
XP_U16 col, XP_U16 row, XP_Bool added );
|
||||||
static void notifyTrayListeners( ModelCtxt* model, XP_U16 turn,
|
static void notifyTrayListeners( ModelCtxt* model, XP_U16 turn,
|
||||||
XP_S16 index1, XP_S16 index2 );
|
XP_S16 index1, XP_S16 index2 );
|
||||||
static CellTile getModelTileRaw( ModelCtxt* model, XP_U16 col, XP_U16 row );
|
static CellTile getModelTileRaw( const ModelCtxt* model, XP_U16 col,
|
||||||
|
XP_U16 row );
|
||||||
static void setModelTileRaw( ModelCtxt* model, XP_U16 col, XP_U16 row,
|
static void setModelTileRaw( ModelCtxt* model, XP_U16 col, XP_U16 row,
|
||||||
CellTile tile );
|
CellTile tile );
|
||||||
static void assignPlayerTiles( ModelCtxt* model, XP_S16 turn,
|
static void assignPlayerTiles( ModelCtxt* model, XP_S16 turn,
|
||||||
|
@ -280,12 +281,12 @@ model_getDictionary( ModelCtxt* model )
|
||||||
} /* model_getDictionary */
|
} /* model_getDictionary */
|
||||||
|
|
||||||
static XP_Bool
|
static XP_Bool
|
||||||
getPendingTileFor( ModelCtxt* model, XP_U16 turn, XP_U16 col, XP_U16 row,
|
getPendingTileFor( const ModelCtxt* model, XP_U16 turn, XP_U16 col, XP_U16 row,
|
||||||
CellTile* cellTile )
|
CellTile* cellTile )
|
||||||
{
|
{
|
||||||
XP_Bool found = XP_FALSE;
|
XP_Bool found = XP_FALSE;
|
||||||
PlayerCtxt* player;
|
const PlayerCtxt* player;
|
||||||
PendingTile* pendings;
|
const PendingTile* pendings;
|
||||||
XP_U16 i;
|
XP_U16 i;
|
||||||
|
|
||||||
player = &model->players[turn];
|
player = &model->players[turn];
|
||||||
|
@ -305,8 +306,8 @@ getPendingTileFor( ModelCtxt* model, XP_U16 turn, XP_U16 col, XP_U16 row,
|
||||||
} /* getPendingTileFor */
|
} /* getPendingTileFor */
|
||||||
|
|
||||||
XP_Bool
|
XP_Bool
|
||||||
model_getTile( ModelCtxt* model, XP_U16 col, XP_U16 row, XP_Bool getPending,
|
model_getTile( const ModelCtxt* model, XP_U16 col, XP_U16 row,
|
||||||
XP_S16 turn, Tile* tileP, XP_Bool* isBlank,
|
XP_Bool getPending, XP_S16 turn, Tile* tileP, XP_Bool* isBlank,
|
||||||
XP_Bool* pendingP, XP_Bool* recentP )
|
XP_Bool* pendingP, XP_Bool* recentP )
|
||||||
{
|
{
|
||||||
CellTile cellTile = getModelTileRaw( model, col, row );
|
CellTile cellTile = getModelTileRaw( model, col, row );
|
||||||
|
@ -456,7 +457,7 @@ setModelTileRaw( ModelCtxt* model, XP_U16 col, XP_U16 row, CellTile tile )
|
||||||
} /* model_setTile */
|
} /* model_setTile */
|
||||||
|
|
||||||
static CellTile
|
static CellTile
|
||||||
getModelTileRaw( ModelCtxt* model, XP_U16 col, XP_U16 row )
|
getModelTileRaw( const ModelCtxt* model, XP_U16 col, XP_U16 row )
|
||||||
{
|
{
|
||||||
XP_ASSERT( col < MAX_COLS );
|
XP_ASSERT( col < MAX_COLS );
|
||||||
XP_ASSERT( row < MAX_ROWS );
|
XP_ASSERT( row < MAX_ROWS );
|
||||||
|
@ -1378,13 +1379,13 @@ model_getNumTilesTotal( ModelCtxt* model, XP_S16 turn )
|
||||||
} /* model_getNumTilesTotal */
|
} /* model_getNumTilesTotal */
|
||||||
|
|
||||||
XP_U16
|
XP_U16
|
||||||
model_numRows( ModelCtxt* model )
|
model_numRows( const ModelCtxt* model )
|
||||||
{
|
{
|
||||||
return model->nRows;
|
return model->nRows;
|
||||||
} /* model_numRows */
|
} /* model_numRows */
|
||||||
|
|
||||||
XP_U16
|
XP_U16
|
||||||
model_numCols( ModelCtxt* model )
|
model_numCols( const ModelCtxt* model )
|
||||||
{
|
{
|
||||||
return model->nCols;
|
return model->nCols;
|
||||||
} /* model_numCols */
|
} /* model_numCols */
|
||||||
|
|
|
@ -110,7 +110,7 @@ void model_setNPlayers( ModelCtxt* model, XP_U16 numPlayers );
|
||||||
void model_setDictionary( ModelCtxt* model, DictionaryCtxt* dict );
|
void model_setDictionary( ModelCtxt* model, DictionaryCtxt* dict );
|
||||||
DictionaryCtxt* model_getDictionary( ModelCtxt* model );
|
DictionaryCtxt* model_getDictionary( ModelCtxt* model );
|
||||||
|
|
||||||
XP_Bool model_getTile( ModelCtxt* model, XP_U16 col, XP_U16 row,
|
XP_Bool model_getTile( const ModelCtxt* model, XP_U16 col, XP_U16 row,
|
||||||
XP_Bool getPending, XP_S16 turn,
|
XP_Bool getPending, XP_S16 turn,
|
||||||
Tile* tile, XP_Bool* isBlank,
|
Tile* tile, XP_Bool* isBlank,
|
||||||
XP_Bool* isPending, XP_Bool* isRecent );
|
XP_Bool* isPending, XP_Bool* isRecent );
|
||||||
|
@ -148,8 +148,8 @@ XP_S16 model_trayContains( ModelCtxt* model, XP_S16 turn, Tile tile );
|
||||||
|
|
||||||
/* void model_setTile( ModelCtxt* model, XP_U16 col, XP_U16 row, */
|
/* void model_setTile( ModelCtxt* model, XP_U16 col, XP_U16 row, */
|
||||||
/* Tile tile, XP_Bool isBlank ); */
|
/* Tile tile, XP_Bool isBlank ); */
|
||||||
XP_U16 model_numRows( ModelCtxt* model );
|
XP_U16 model_numRows( const ModelCtxt* model );
|
||||||
XP_U16 model_numCols( ModelCtxt* model );
|
XP_U16 model_numCols( const ModelCtxt* model );
|
||||||
|
|
||||||
/* XP_U16 model_numTilesCurrentTray( ModelCtxt* model ); */
|
/* XP_U16 model_numTilesCurrentTray( ModelCtxt* model ); */
|
||||||
/* Tile model_currentTrayTile( ModelCtxt* model, XP_U16 index ); */
|
/* Tile model_currentTrayTile( ModelCtxt* model, XP_U16 index ); */
|
||||||
|
@ -233,7 +233,7 @@ void model_figureFinalScores( ModelCtxt* model, XP_S16* scores,
|
||||||
XP_S16* tilePenalties );
|
XP_S16* tilePenalties );
|
||||||
|
|
||||||
/* figureMoveScore is meant only for the engine's use */
|
/* figureMoveScore is meant only for the engine's use */
|
||||||
XP_U16 figureMoveScore( ModelCtxt* model, MoveInfo* moveInfo,
|
XP_U16 figureMoveScore( const ModelCtxt* model, MoveInfo* moveInfo,
|
||||||
EngineCtxt* engine, XWStreamCtxt* stream,
|
EngineCtxt* engine, XWStreamCtxt* stream,
|
||||||
WordNotifierInfo* notifyInfo, XP_UCHAR* mainWord );
|
WordNotifierInfo* notifyInfo, XP_UCHAR* mainWord );
|
||||||
|
|
||||||
|
|
|
@ -31,10 +31,11 @@ extern "C" {
|
||||||
|
|
||||||
/****************************** prototypes ******************************/
|
/****************************** prototypes ******************************/
|
||||||
static XP_Bool isLegalMove( ModelCtxt* model, MoveInfo* moves, XP_Bool silent );
|
static XP_Bool isLegalMove( ModelCtxt* model, MoveInfo* moves, XP_Bool silent );
|
||||||
static XP_U16 word_multiplier( ModelCtxt* model, XP_U16 col, XP_U16 row );
|
static XP_U16 word_multiplier( const ModelCtxt* model,
|
||||||
static XP_U16 find_end( ModelCtxt* model, XP_U16 col, XP_U16 row,
|
XP_U16 col, XP_U16 row );
|
||||||
|
static XP_U16 find_end( const ModelCtxt* model, XP_U16 col, XP_U16 row,
|
||||||
XP_Bool isHorizontal );
|
XP_Bool isHorizontal );
|
||||||
static XP_U16 find_start( ModelCtxt* model, XP_U16 col, XP_U16 row,
|
static XP_U16 find_start( const ModelCtxt* model, XP_U16 col, XP_U16 row,
|
||||||
XP_Bool isHorizontal );
|
XP_Bool isHorizontal );
|
||||||
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,
|
||||||
|
@ -43,7 +44,7 @@ static XP_S16 checkScoreMove( ModelCtxt* model, XP_S16 turn,
|
||||||
/* EngineCtxt* engine, */
|
/* EngineCtxt* engine, */
|
||||||
/* XP_Bool silent, short moveMultiplier, */
|
/* XP_Bool silent, short moveMultiplier, */
|
||||||
/* WordNotifierInfo* notifyInfo ); */
|
/* WordNotifierInfo* notifyInfo ); */
|
||||||
static XP_U16 scoreWord( 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 );
|
||||||
|
|
||||||
|
@ -69,7 +70,7 @@ static void wordScoreFormatterFinish( WordScoreFormatter* fmtr, Tile* word,
|
||||||
XWStreamCtxt* stream, XP_UCHAR* mainWord );
|
XWStreamCtxt* stream, XP_UCHAR* mainWord );
|
||||||
static void formatWordScore( XWStreamCtxt* stream, XP_U16 wordScore,
|
static void formatWordScore( XWStreamCtxt* stream, XP_U16 wordScore,
|
||||||
XP_U16 moveMultiplier );
|
XP_U16 moveMultiplier );
|
||||||
static void formatSummary( XWStreamCtxt* stream, ModelCtxt* model,
|
static void formatSummary( XWStreamCtxt* stream, const ModelCtxt* model,
|
||||||
XP_U16 score );
|
XP_U16 score );
|
||||||
|
|
||||||
|
|
||||||
|
@ -313,7 +314,7 @@ normalizeMoves( ModelCtxt* model, XP_S16 turn, XP_Bool isHorizontal,
|
||||||
} /* normalizeMoves */
|
} /* normalizeMoves */
|
||||||
|
|
||||||
static XP_Bool
|
static XP_Bool
|
||||||
modelIsEmptyAt( ModelCtxt* model, XP_U16 col, XP_U16 row )
|
modelIsEmptyAt( const ModelCtxt* model, XP_U16 col, XP_U16 row )
|
||||||
{
|
{
|
||||||
Tile tile;
|
Tile tile;
|
||||||
XP_Bool ignore;
|
XP_Bool ignore;
|
||||||
|
@ -443,9 +444,9 @@ isLegalMove( ModelCtxt* model, MoveInfo* mInfo, XP_Bool silent )
|
||||||
} /* isLegalMove */
|
} /* isLegalMove */
|
||||||
|
|
||||||
XP_U16
|
XP_U16
|
||||||
figureMoveScore( ModelCtxt* model, MoveInfo* moveInfo, EngineCtxt* engine,
|
figureMoveScore( const ModelCtxt* model, MoveInfo* moveInfo,
|
||||||
XWStreamCtxt* stream, WordNotifierInfo* notifyInfo,
|
EngineCtxt* engine, XWStreamCtxt* stream,
|
||||||
XP_UCHAR* mainWord )
|
WordNotifierInfo* notifyInfo, XP_UCHAR* mainWord )
|
||||||
{
|
{
|
||||||
XP_U16 col, row;
|
XP_U16 col, row;
|
||||||
XP_U16* incr;
|
XP_U16* incr;
|
||||||
|
@ -527,7 +528,7 @@ figureMoveScore( ModelCtxt* model, MoveInfo* moveInfo, EngineCtxt* engine,
|
||||||
} /* figureMoveScore */
|
} /* figureMoveScore */
|
||||||
|
|
||||||
static XP_U16
|
static XP_U16
|
||||||
word_multiplier( ModelCtxt* model, XP_U16 col, XP_U16 row )
|
word_multiplier( const ModelCtxt* model, XP_U16 col, XP_U16 row )
|
||||||
{
|
{
|
||||||
XWBonusType bonus = util_getSquareBonus( model->vol.util, model, col, row );
|
XWBonusType bonus = util_getSquareBonus( model->vol.util, model, col, row );
|
||||||
switch ( bonus ) {
|
switch ( bonus ) {
|
||||||
|
@ -541,7 +542,7 @@ word_multiplier( ModelCtxt* model, XP_U16 col, XP_U16 row )
|
||||||
} /* word_multiplier */
|
} /* word_multiplier */
|
||||||
|
|
||||||
static XP_U16
|
static XP_U16
|
||||||
tile_multiplier( ModelCtxt* model, XP_U16 col, XP_U16 row )
|
tile_multiplier( const ModelCtxt* model, XP_U16 col, XP_U16 row )
|
||||||
{
|
{
|
||||||
XWBonusType bonus = util_getSquareBonus( model->vol.util, model,
|
XWBonusType bonus = util_getSquareBonus( model->vol.util, model,
|
||||||
col, row );
|
col, row );
|
||||||
|
@ -556,7 +557,7 @@ tile_multiplier( ModelCtxt* model, XP_U16 col, XP_U16 row )
|
||||||
} /* tile_multiplier */
|
} /* tile_multiplier */
|
||||||
|
|
||||||
static XP_U16
|
static XP_U16
|
||||||
scoreWord( 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,
|
||||||
|
@ -703,7 +704,8 @@ scoreWord( ModelCtxt* model, MoveInfo* movei, /* new tiles */
|
||||||
} /* scoreWord */
|
} /* scoreWord */
|
||||||
|
|
||||||
static XP_U16
|
static XP_U16
|
||||||
find_start( ModelCtxt* model, XP_U16 col, XP_U16 row, XP_Bool isHorizontal )
|
find_start( const ModelCtxt* model, XP_U16 col, XP_U16 row,
|
||||||
|
XP_Bool isHorizontal )
|
||||||
{
|
{
|
||||||
XP_U16* incr = isHorizontal? &col: &row;
|
XP_U16* incr = isHorizontal? &col: &row;
|
||||||
|
|
||||||
|
@ -720,7 +722,8 @@ find_start( ModelCtxt* model, XP_U16 col, XP_U16 row, XP_Bool isHorizontal )
|
||||||
} /* find_start */
|
} /* find_start */
|
||||||
|
|
||||||
static XP_U16
|
static XP_U16
|
||||||
find_end( ModelCtxt* model, XP_U16 col, XP_U16 row, XP_Bool isHorizontal )
|
find_end( const ModelCtxt* model, XP_U16 col, XP_U16 row,
|
||||||
|
XP_Bool isHorizontal )
|
||||||
{
|
{
|
||||||
XP_U16* incr = isHorizontal? &col: &row;
|
XP_U16* incr = isHorizontal? &col: &row;
|
||||||
XP_U16 limit = isHorizontal? MAX_COLS-1:MAX_ROWS-1;
|
XP_U16 limit = isHorizontal? MAX_COLS-1:MAX_ROWS-1;
|
||||||
|
@ -835,7 +838,7 @@ formatWordScore( XWStreamCtxt* stream, XP_U16 wordScore,
|
||||||
} /* formatWordScore */
|
} /* formatWordScore */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
formatSummary( XWStreamCtxt* stream, ModelCtxt* model, XP_U16 score )
|
formatSummary( XWStreamCtxt* stream, const ModelCtxt* model, XP_U16 score )
|
||||||
{
|
{
|
||||||
XP_UCHAR buf[60];
|
XP_UCHAR buf[60];
|
||||||
XP_SNPRINTF(buf, sizeof(buf),
|
XP_SNPRINTF(buf, sizeof(buf),
|
||||||
|
|
|
@ -105,7 +105,8 @@ typedef struct UtilVtable {
|
||||||
XP_PlayerAddr channelNo );
|
XP_PlayerAddr channelNo );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
XWBonusType (*m_util_getSquareBonus)( XW_UtilCtxt* uc, ModelCtxt* model,
|
XWBonusType (*m_util_getSquareBonus)( XW_UtilCtxt* uc,
|
||||||
|
const ModelCtxt* model,
|
||||||
XP_U16 col, XP_U16 row );
|
XP_U16 col, XP_U16 row );
|
||||||
void (*m_util_userError)( XW_UtilCtxt* uc, UtilErrID id );
|
void (*m_util_userError)( XW_UtilCtxt* uc, UtilErrID id );
|
||||||
|
|
||||||
|
|
|
@ -625,7 +625,7 @@ linux_util_makeEmptyDict( XW_UtilCtxt* uctx )
|
||||||
|
|
||||||
static XWBonusType
|
static XWBonusType
|
||||||
linux_util_getSquareBonus( XW_UtilCtxt* XP_UNUSED(uc),
|
linux_util_getSquareBonus( XW_UtilCtxt* XP_UNUSED(uc),
|
||||||
ModelCtxt* XP_UNUSED(model),
|
const ModelCtxt* XP_UNUSED(model),
|
||||||
XP_U16 col, XP_U16 row )
|
XP_U16 col, XP_U16 row )
|
||||||
{
|
{
|
||||||
XP_U16 index;
|
XP_U16 index;
|
||||||
|
|
|
@ -104,7 +104,7 @@ static void palm_util_userError( XW_UtilCtxt* uc, UtilErrID id );
|
||||||
static XP_Bool palm_util_userQuery( XW_UtilCtxt* uc, UtilQueryID id,
|
static XP_Bool palm_util_userQuery( XW_UtilCtxt* uc, UtilQueryID id,
|
||||||
XWStreamCtxt* stream );
|
XWStreamCtxt* stream );
|
||||||
static XWBonusType palm_util_getSquareBonus( XW_UtilCtxt* uc,
|
static XWBonusType palm_util_getSquareBonus( XW_UtilCtxt* uc,
|
||||||
ModelCtxt* model,
|
const ModelCtxt* model,
|
||||||
XP_U16 col, XP_U16 row );
|
XP_U16 col, XP_U16 row );
|
||||||
static XP_S16 palm_util_userPickTile( XW_UtilCtxt* uc, const PickInfo* pi,
|
static XP_S16 palm_util_userPickTile( XW_UtilCtxt* uc, const PickInfo* pi,
|
||||||
XP_U16 playerNum, const XP_UCHAR4* texts,
|
XP_U16 playerNum, const XP_UCHAR4* texts,
|
||||||
|
@ -3721,7 +3721,7 @@ palm_util_userQuery( XW_UtilCtxt* uc, UtilQueryID id, XWStreamCtxt* stream )
|
||||||
} /* palm_util_userQuery */
|
} /* palm_util_userQuery */
|
||||||
|
|
||||||
static XWBonusType
|
static XWBonusType
|
||||||
palm_util_getSquareBonus( XW_UtilCtxt* uc, ModelCtxt* model,
|
palm_util_getSquareBonus( XW_UtilCtxt* uc, const ModelCtxt* model,
|
||||||
XP_U16 col, XP_U16 row )
|
XP_U16 col, XP_U16 row )
|
||||||
{
|
{
|
||||||
PalmAppGlobals* globals = (PalmAppGlobals*)uc->closure;
|
PalmAppGlobals* globals = (PalmAppGlobals*)uc->closure;
|
||||||
|
|
|
@ -92,7 +92,7 @@ static void ce_util_userError( XW_UtilCtxt* uc, UtilErrID id );
|
||||||
static XP_Bool ce_util_userQuery( XW_UtilCtxt* uc, UtilQueryID id,
|
static XP_Bool ce_util_userQuery( XW_UtilCtxt* uc, UtilQueryID id,
|
||||||
XWStreamCtxt* stream );
|
XWStreamCtxt* stream );
|
||||||
static XWBonusType ce_util_getSquareBonus( XW_UtilCtxt* uc,
|
static XWBonusType ce_util_getSquareBonus( XW_UtilCtxt* uc,
|
||||||
ModelCtxt* model,
|
const ModelCtxt* model,
|
||||||
XP_U16 col, XP_U16 row );
|
XP_U16 col, XP_U16 row );
|
||||||
static XP_S16 ce_util_userPickTile( XW_UtilCtxt* uc, const PickInfo* pi,
|
static XP_S16 ce_util_userPickTile( XW_UtilCtxt* uc, const PickInfo* pi,
|
||||||
XP_U16 playerNum,
|
XP_U16 playerNum,
|
||||||
|
@ -2739,7 +2739,7 @@ ce_util_userQuery( XW_UtilCtxt* uc, UtilQueryID id, XWStreamCtxt* stream )
|
||||||
} /* ce_util_userQuery */
|
} /* ce_util_userQuery */
|
||||||
|
|
||||||
static XWBonusType
|
static XWBonusType
|
||||||
ce_util_getSquareBonus( XW_UtilCtxt* uc, ModelCtxt* XP_UNUSED(model),
|
ce_util_getSquareBonus( XW_UtilCtxt* uc, const ModelCtxt* XP_UNUSED(model),
|
||||||
XP_U16 col, XP_U16 row )
|
XP_U16 col, XP_U16 row )
|
||||||
{
|
{
|
||||||
XP_U16 index;
|
XP_U16 index;
|
||||||
|
|
Loading…
Reference in a new issue