mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-23 07:27:22 +01:00
Merge remote-tracking branch 'origin/android_branch' into android_branch
# Please enter a commit message to explain why this merge is necessary, # especially if it merges an updated upstream into a topic branch. # # Lines starting with '#' will be ignored, and an empty message aborts # the commit.
This commit is contained in:
commit
05d0974823
2 changed files with 33 additions and 12 deletions
|
@ -40,9 +40,7 @@ do_dir() {
|
||||||
for FILE in $SRC_PATH/*; do
|
for FILE in $SRC_PATH/*; do
|
||||||
if [ -d $FILE ]; then
|
if [ -d $FILE ]; then
|
||||||
do_dir $SRC_PATH $DEST_PATH $(basename $FILE)
|
do_dir $SRC_PATH $DEST_PATH $(basename $FILE)
|
||||||
elif [ ! -e $FILE ]; then
|
elif [ -e $FILE ]; then
|
||||||
:
|
|
||||||
else
|
|
||||||
FILE=${FILE/$SRC_PATH/$DEST_PATH}
|
FILE=${FILE/$SRC_PATH/$DEST_PATH}
|
||||||
if git ls-files $FILE --error-unmatch 2>/dev/null; then
|
if git ls-files $FILE --error-unmatch 2>/dev/null; then
|
||||||
echo "skipping $FILE; it's under version control within this variant"
|
echo "skipping $FILE; it's under version control within this variant"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* -*- compile-command: "cd ../linux && make -j3 MEMDEBUG=TRUE"; -*- */
|
/* -*- compile-command: "cd ../linux && make -j3 MEMDEBUG=TRUE"; -*- */
|
||||||
/*
|
/*
|
||||||
* Copyright 1997 - 2012 by Eric House (xwords@eehouse.org). All rights
|
* Copyright 1997 - 2015 by Eric House (xwords@eehouse.org). All rights
|
||||||
* reserved.
|
* reserved.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
|
@ -39,11 +39,10 @@ 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
|
||||||
the comparison must be done differently on
|
comparison must be done differently on little-endian
|
||||||
little-endian platforms. */
|
platforms. */
|
||||||
MoveInfo moveInfo;
|
MoveInfo moveInfo;
|
||||||
//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;
|
||||||
|
@ -1088,12 +1087,26 @@ considerMove( EngineCtxt* engine, Tile* tiles, XP_S16 tileLength,
|
||||||
posmove.moveInfo.isHorizontal = engine->searchHorizontal;
|
posmove.moveInfo.isHorizontal = engine->searchHorizontal;
|
||||||
posmove.moveInfo.commonCoord = (XP_U8)lastRow;
|
posmove.moveInfo.commonCoord = (XP_U8)lastRow;
|
||||||
|
|
||||||
|
|
||||||
considerScoreWordHasBlanks( engine, engine->blankCount, &posmove,
|
considerScoreWordHasBlanks( engine, engine->blankCount, &posmove,
|
||||||
lastRow, blankTuples, 0 );
|
lastRow, blankTuples, 0 );
|
||||||
}
|
}
|
||||||
} /* considerMove */
|
} /* considerMove */
|
||||||
|
|
||||||
|
static XP_Bool
|
||||||
|
countWords( const XP_UCHAR* XP_UNUSED(word), XP_Bool isLegal,
|
||||||
|
const DictionaryCtxt* XP_UNUSED(dict),
|
||||||
|
#ifdef XWFEATURE_BOARDWORDS
|
||||||
|
const MoveInfo* movei, XP_U16 start,
|
||||||
|
XP_U16 end,
|
||||||
|
#endif
|
||||||
|
void* closure )
|
||||||
|
{
|
||||||
|
XP_U16* wcp = (XP_U16*)closure;
|
||||||
|
if ( isLegal ) {
|
||||||
|
++*wcp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
considerScoreWordHasBlanks( EngineCtxt* engine, XP_U16 blanksLeft,
|
considerScoreWordHasBlanks( EngineCtxt* engine, XP_U16 blanksLeft,
|
||||||
PossibleMove* posmove,
|
PossibleMove* posmove,
|
||||||
|
@ -1104,11 +1117,19 @@ considerScoreWordHasBlanks( EngineCtxt* engine, XP_U16 blanksLeft,
|
||||||
|
|
||||||
if ( blanksLeft == 0 ) {
|
if ( blanksLeft == 0 ) {
|
||||||
XP_U16 score;
|
XP_U16 score;
|
||||||
|
XP_U16 nTiles = posmove->moveInfo.nTiles;
|
||||||
|
WordNotifierInfo* wiip = NULL;
|
||||||
|
WordNotifierInfo wii;
|
||||||
|
XP_U16 wordCount = 0;
|
||||||
|
if ( 1 == nTiles ) {
|
||||||
|
wii.proc = countWords;
|
||||||
|
wii.closure = &wordCount;
|
||||||
|
wiip = &wii;
|
||||||
|
}
|
||||||
|
|
||||||
score = figureMoveScore( engine->model, engine->turn,
|
score = figureMoveScore( engine->model, engine->turn,
|
||||||
&posmove->moveInfo,
|
&posmove->moveInfo,
|
||||||
engine, (XWStreamCtxt*)NULL,
|
engine, (XWStreamCtxt*)NULL, wiip );
|
||||||
(WordNotifierInfo*)NULL );
|
|
||||||
#ifdef XWFEATURE_BONUSALL
|
#ifdef XWFEATURE_BONUSALL
|
||||||
if ( 0 != engine->allTilesBonus && 0 == engine->nTilesMax ) {
|
if ( 0 != engine->allTilesBonus && 0 == engine->nTilesMax ) {
|
||||||
XP_LOGF( "%s: adding bonus: %d becoming %d", __func__, score ,
|
XP_LOGF( "%s: adding bonus: %d becoming %d", __func__, score ,
|
||||||
|
@ -1119,7 +1140,9 @@ considerScoreWordHasBlanks( EngineCtxt* engine, XP_U16 blanksLeft,
|
||||||
/* First, check that the score is even what we're interested in. If
|
/* First, check that the score is even what we're interested in. If
|
||||||
it is, then go to the expense of filling in a PossibleMove to be
|
it is, then go to the expense of filling in a PossibleMove to be
|
||||||
compared in full */
|
compared in full */
|
||||||
if ( scoreQualifies( engine, score ) ) {
|
if ( 1 == nTiles && 1 < wordCount && !engine->searchHorizontal ) {
|
||||||
|
XP_LOGF( "%s(): dropping", __func__ );
|
||||||
|
} else if ( scoreQualifies( engine, score ) ) {
|
||||||
posmove->score = score;
|
posmove->score = score;
|
||||||
XP_MEMSET( &posmove->blankVals, 0, sizeof(posmove->blankVals) );
|
XP_MEMSET( &posmove->blankVals, 0, sizeof(posmove->blankVals) );
|
||||||
for ( ii = 0; ii < usedBlanksCount; ++ii ) {
|
for ( ii = 0; ii < usedBlanksCount; ++ii ) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue