Merge branch 'android_branch' into android_translate

This commit is contained in:
Eric House 2015-09-16 07:08:53 -07:00
commit a9ddf98541
9 changed files with 71 additions and 34 deletions

View file

@ -74,7 +74,7 @@ public class SMSService extends XWService {
private static final int SMS_PROTO_VERSION_ORIG = 0;
private static final int SMS_PROTO_VERSION_WITHPORT = 1;
private static final int SMS_PROTO_VERSION = SMS_PROTO_VERSION_WITHPORT;
private static final int SMS_PROTO_VERSION = SMS_PROTO_VERSION_ORIG;
private static final int MAX_LEN_TEXT = 100;
private static final int MAX_LEN_BINARY = 100;
private static final int MAX_MSG_COUNT = 16; // 1.6K enough? Should be....
@ -452,7 +452,9 @@ public class SMSService extends XWService {
ByteArrayOutputStream bas = new ByteArrayOutputStream( 128 );
DataOutputStream dos = new DataOutputStream( bas );
dos.writeByte( SMS_PROTO_VERSION );
dos.writeShort( getNBSPort() );
if ( SMS_PROTO_VERSION_WITHPORT <= SMS_PROTO_VERSION ) {
dos.writeShort( getNBSPort() );
}
dos.writeByte( cmd.ordinal() );
dos.write( bytes, 0, bytes.length );
dos.flush();
@ -607,19 +609,19 @@ public class SMSService extends XWService {
try {
byte proto = dis.readByte();
short myPort = getNBSPort();
short sentPort;
short gotPort;
if ( SMS_PROTO_VERSION_WITHPORT > proto ) {
sentPort = myPort;
gotPort = myPort;
} else {
sentPort = dis.readShort();
gotPort = dis.readShort();
}
if ( SMS_PROTO_VERSION < proto ) {
DbgUtils.logf( "SMSService.disAssemble: bad proto %d from %s;"
+ " dropping", proto, senderPhone );
sendResult( MultiEvent.BAD_PROTO_SMS, senderPhone );
} else if ( sentPort != myPort ) {
} else if ( gotPort != myPort ) {
DbgUtils.logdf( "SMSService.disAssemble(): received on port %d"
+ " but expected %d", sentPort, myPort );
+ " but expected %d", gotPort, myPort );
} else {
SMS_CMD cmd = SMS_CMD.values()[dis.readByte()];
byte[] rest = new byte[dis.available()];

View file

@ -36,6 +36,7 @@
<arg value="CHAT_ENABLED=${CHAT_ENABLED}" />
<arg value="THUMBNAIL_ENABLED=${THUMBNAIL_ENABLED}" />
<arg value="VARIANT=${VARIANT_NAME}" />
<arg value="V=1" />
</exec>
<exec dir="." executable="../scripts/mkimages.sh"

View file

@ -0,0 +1,16 @@
#!/bin/sh
usage() {
[ $# -eq 0 ] || echo "ERROR: $1"
echo "usage: $0"
echo " git-copies all strings.xml translations from android_translate"
echo " branch to the current one. DOES NOT COMMIT nor consider history etc."
exit 1
}
[ $# -eq 0 ] || usage "unexpected paramater $1"
for LANGDIR in res_src/values-??; do
echo "copying from $LANGDIR"
git show android_translate:xwords4/android/XWords4/${LANGDIR}/strings.xml > ${LANGDIR}/strings.xml
done

View file

@ -40,9 +40,7 @@ do_dir() {
for FILE in $SRC_PATH/*; do
if [ -d $FILE ]; then
do_dir $SRC_PATH $DEST_PATH $(basename $FILE)
elif [ ! -e $FILE ]; then
:
else
elif [ -e $FILE ]; then
FILE=${FILE/$SRC_PATH/$DEST_PATH}
if git ls-files $FILE --error-unmatch 2>/dev/null; then
echo "skipping $FILE; it's under version control within this variant"

View file

@ -946,7 +946,7 @@ hideMiniWindow( BoardCtxt* board, XP_Bool destroy, MiniWindowType winType )
#endif
#endif
static XP_Bool
static void
warnBadWords( const XP_UCHAR* word, XP_Bool isLegal,
const DictionaryCtxt* XP_UNUSED(dict),
#ifdef XWFEATURE_BOARDWORDS
@ -970,7 +970,6 @@ warnBadWords( const XP_UCHAR* word, XP_Bool isLegal,
&& util_warnIllegalWord( board->util, &bwi, turn, XP_FALSE );
board->badWordRejected = !ok || board->badWordRejected;
}
return ok;
} /* warnBadWords */
static XP_Bool

View file

@ -1,6 +1,6 @@
/* -*- 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.
*
* This program is free software; you can redistribute it and/or
@ -39,11 +39,10 @@ typedef struct BlankTuple {
} BlankTuple;
typedef struct PossibleMove {
XP_U16 score; /* Because I'm doing a memcmp to sort these things,
the comparison must be done differently on
little-endian platforms. */
XP_U16 score; /* Because I'm doing a memcmp to sort these things, the
comparison must be done differently on little-endian
platforms. */
MoveInfo moveInfo;
//XP_U16 whichBlanks; /* flags */
Tile blankVals[MAX_COLS]; /* the faces for which we've substituted
blanks */
} PossibleMove;
@ -1088,12 +1087,26 @@ considerMove( EngineCtxt* engine, Tile* tiles, XP_S16 tileLength,
posmove.moveInfo.isHorizontal = engine->searchHorizontal;
posmove.moveInfo.commonCoord = (XP_U8)lastRow;
considerScoreWordHasBlanks( engine, engine->blankCount, &posmove,
lastRow, blankTuples, 0 );
}
} /* 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
considerScoreWordHasBlanks( EngineCtxt* engine, XP_U16 blanksLeft,
PossibleMove* posmove,
@ -1104,11 +1117,19 @@ considerScoreWordHasBlanks( EngineCtxt* engine, XP_U16 blanksLeft,
if ( blanksLeft == 0 ) {
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,
&posmove->moveInfo,
engine, (XWStreamCtxt*)NULL,
(WordNotifierInfo*)NULL );
engine, (XWStreamCtxt*)NULL, wiip );
#ifdef XWFEATURE_BONUSALL
if ( 0 != engine->allTilesBonus && 0 == engine->nTilesMax ) {
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
it is, then go to the expense of filling in a PossibleMove to be
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;
XP_MEMSET( &posmove->blankVals, 0, sizeof(posmove->blankVals) );
for ( ii = 0; ii < usedBlanksCount; ++ii ) {

View file

@ -78,13 +78,13 @@ static void loadPlayerCtxt( const ModelCtxt* model, XWStreamCtxt* stream,
static void writePlayerCtxt( const ModelCtxt* model, XWStreamCtxt* stream,
const PlayerCtxt* pc );
static XP_U16 model_getRecentPassCount( ModelCtxt* model );
static XP_Bool recordWord( const XP_UCHAR* word, XP_Bool isLegal,
const DictionaryCtxt* dict,
static void recordWord( const XP_UCHAR* word, XP_Bool isLegal,
const DictionaryCtxt* dict,
#ifdef XWFEATURE_BOARDWORDS
const MoveInfo* movei, XP_U16 start, XP_U16 end,
const MoveInfo* movei, XP_U16 start, XP_U16 end,
#endif
void* clsur );
void* clsur );
#ifdef DEBUG
typedef struct _DiffTurnState {
XP_S16 lastPlayerNum;
@ -2281,7 +2281,7 @@ appendWithCR( XWStreamCtxt* stream, const XP_UCHAR* word, XP_U16* counter )
stream_catString( stream, word );
}
static XP_Bool
static void
recordWord( const XP_UCHAR* word, XP_Bool XP_UNUSED(isLegal),
const DictionaryCtxt* XP_UNUSED(dict),
#ifdef XWFEATURE_BOARDWORDS
@ -2293,7 +2293,6 @@ recordWord( const XP_UCHAR* word, XP_Bool XP_UNUSED(isLegal),
{
RecordWordsInfo* info = (RecordWordsInfo*)closure;
appendWithCR( info->stream, word, &info->nWords );
return XP_TRUE;
}
WordNotifierInfo*

View file

@ -256,13 +256,13 @@ void model_countAllTrayTiles( ModelCtxt* model, XP_U16* counts,
/********************* scoring ********************/
typedef XP_Bool (*WordNotifierProc)( const XP_UCHAR* word, XP_Bool isLegal,
const DictionaryCtxt* dict,
typedef void (*WordNotifierProc)( const XP_UCHAR* word, XP_Bool isLegal,
const DictionaryCtxt* dict,
#ifdef XWFEATURE_BOARDWORDS
const MoveInfo* movei, XP_U16 start,
XP_U16 end,
const MoveInfo* movei, XP_U16 start,
XP_U16 end,
#endif
void* closure );
void* closure );
typedef struct WordNotifierInfo {
WordNotifierProc proc;
void* closure;

View file

@ -1975,7 +1975,7 @@ server_setGameOverListener( ServerCtxt* server, GameOverListener gol,
server->vol.gameOverData = data;
} /* server_setGameOverListener */
static XP_Bool
static void
storeBadWords( const XP_UCHAR* word, XP_Bool isLegal,
const DictionaryCtxt* dict,
#ifdef XWFEATURE_BOARDWORDS
@ -1995,7 +1995,6 @@ storeBadWords( const XP_UCHAR* word, XP_Bool isLegal,
server->illegalWordInfo.words[server->illegalWordInfo.nWords++]
= copyString( server->mpool, word );
}
return XP_TRUE;
} /* storeBadWords */
static XP_Bool