mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-28 07:58:08 +01:00
switch for loop to using C99-style variable declarations; no other change
This commit is contained in:
parent
53bfe9812d
commit
938756a34f
5 changed files with 36 additions and 63 deletions
|
@ -92,9 +92,8 @@ static XP_U16
|
||||||
andCountSpecials( AndDictionaryCtxt* ctxt )
|
andCountSpecials( AndDictionaryCtxt* ctxt )
|
||||||
{
|
{
|
||||||
XP_U16 result = 0;
|
XP_U16 result = 0;
|
||||||
XP_U16 ii;
|
|
||||||
|
|
||||||
for ( ii = 0; ii < ctxt->super.nFaces; ++ii ) {
|
for ( int ii = 0; ii < ctxt->super.nFaces; ++ii ) {
|
||||||
if ( IS_SPECIAL( ctxt->super.facePtrs[ii][0] ) ) {
|
if ( IS_SPECIAL( ctxt->super.facePtrs[ii][0] ) ) {
|
||||||
++result;
|
++result;
|
||||||
}
|
}
|
||||||
|
@ -121,14 +120,13 @@ andMakeBitmap( AndDictionaryCtxt* ctxt, XP_U8 const** ptrp,
|
||||||
#else
|
#else
|
||||||
XP_U8 srcByte = 0;
|
XP_U8 srcByte = 0;
|
||||||
XP_U8 nBits;
|
XP_U8 nBits;
|
||||||
XP_U16 ii;
|
|
||||||
|
|
||||||
jboolean* colors = (jboolean*)XP_CALLOC( ctxt->super.mpool,
|
jboolean* colors = (jboolean*)XP_CALLOC( ctxt->super.mpool,
|
||||||
nCols * nRows * sizeof(*colors) );
|
nCols * nRows * sizeof(*colors) );
|
||||||
jboolean* next = colors;
|
jboolean* next = colors;
|
||||||
|
|
||||||
nBits = nRows * nCols;
|
nBits = nRows * nCols;
|
||||||
for ( ii = 0; ii < nBits; ++ii ) {
|
for ( int ii = 0; ii < nBits; ++ii ) {
|
||||||
XP_U8 srcBitIndex = ii % 8;
|
XP_U8 srcBitIndex = ii % 8;
|
||||||
XP_U8 srcMask;
|
XP_U8 srcMask;
|
||||||
|
|
||||||
|
@ -164,7 +162,6 @@ andLoadSpecialData( AndDictionaryCtxt* ctxt, XP_U8 const** ptrp,
|
||||||
XP_Bool success = XP_TRUE;
|
XP_Bool success = XP_TRUE;
|
||||||
XP_U16 nSpecials = andCountSpecials( ctxt );
|
XP_U16 nSpecials = andCountSpecials( ctxt );
|
||||||
XP_U8 const* ptr = *ptrp;
|
XP_U8 const* ptr = *ptrp;
|
||||||
Tile ii;
|
|
||||||
XP_UCHAR** texts;
|
XP_UCHAR** texts;
|
||||||
XP_UCHAR** textEnds;
|
XP_UCHAR** textEnds;
|
||||||
SpecialBitmaps* bitmaps;
|
SpecialBitmaps* bitmaps;
|
||||||
|
@ -177,7 +174,7 @@ andLoadSpecialData( AndDictionaryCtxt* ctxt, XP_U8 const** ptrp,
|
||||||
bitmaps = (SpecialBitmaps*)
|
bitmaps = (SpecialBitmaps*)
|
||||||
XP_CALLOC( ctxt->super.mpool, nSpecials * sizeof(*bitmaps) );
|
XP_CALLOC( ctxt->super.mpool, nSpecials * sizeof(*bitmaps) );
|
||||||
|
|
||||||
for ( ii = 0; ii < ctxt->super.nFaces; ++ii ) {
|
for ( Tile ii = 0; ii < ctxt->super.nFaces; ++ii ) {
|
||||||
|
|
||||||
const XP_UCHAR* facep = ctxt->super.facePtrs[(short)ii];
|
const XP_UCHAR* facep = ctxt->super.facePtrs[(short)ii];
|
||||||
if ( IS_SPECIAL(*facep) ) {
|
if ( IS_SPECIAL(*facep) ) {
|
||||||
|
@ -239,17 +236,16 @@ splitFaces_via_java( JNIEnv* env, AndDictionaryCtxt* ctxt, const XP_U8* ptr,
|
||||||
int indx = 0;
|
int indx = 0;
|
||||||
int offsets[nFaces];
|
int offsets[nFaces];
|
||||||
int nBytes;
|
int nBytes;
|
||||||
int ii, jj;
|
|
||||||
|
|
||||||
jobject jstrarr = and_util_splitFaces( ctxt->jniutil, ptr, nFaceBytes,
|
jobject jstrarr = and_util_splitFaces( ctxt->jniutil, ptr, nFaceBytes,
|
||||||
isUTF8 );
|
isUTF8 );
|
||||||
XP_ASSERT( (*env)->GetArrayLength( env, jstrarr ) == nFaces );
|
XP_ASSERT( (*env)->GetArrayLength( env, jstrarr ) == nFaces );
|
||||||
|
|
||||||
for ( ii = 0; ii < nFaces; ++ii ) {
|
for ( int ii = 0; ii < nFaces; ++ii ) {
|
||||||
jobject jstrs = (*env)->GetObjectArrayElement( env, jstrarr, ii );
|
jobject jstrs = (*env)->GetObjectArrayElement( env, jstrarr, ii );
|
||||||
offsets[ii] = indx;
|
offsets[ii] = indx;
|
||||||
int nAlternates = (*env)->GetArrayLength( env, jstrs );
|
int nAlternates = (*env)->GetArrayLength( env, jstrs );
|
||||||
for ( jj = 0; jj < nAlternates; ++jj ) {
|
for ( int jj = 0; jj < nAlternates; ++jj ) {
|
||||||
jobject jstr = (*env)->GetObjectArrayElement( env, jstrs, jj );
|
jobject jstr = (*env)->GetObjectArrayElement( env, jstrs, jj );
|
||||||
nBytes = (*env)->GetStringUTFLength( env, jstr );
|
nBytes = (*env)->GetStringUTFLength( env, jstr );
|
||||||
|
|
||||||
|
@ -280,7 +276,7 @@ splitFaces_via_java( JNIEnv* env, AndDictionaryCtxt* ctxt, const XP_U8* ptr,
|
||||||
XP_CALLOC( ctxt->super.mpool, nFaces * sizeof(ptrs[0]));
|
XP_CALLOC( ctxt->super.mpool, nFaces * sizeof(ptrs[0]));
|
||||||
|
|
||||||
XP_MEMCPY( faces, facesBuf, indx );
|
XP_MEMCPY( faces, facesBuf, indx );
|
||||||
for ( ii = 0; ii < nFaces; ++ii ) {
|
for ( int ii = 0; ii < nFaces; ++ii ) {
|
||||||
ptrs[ii] = &faces[offsets[ii]];
|
ptrs[ii] = &faces[offsets[ii]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -312,7 +308,6 @@ parseDict( AndDictionaryCtxt* ctxt, XP_U8 const* ptr, XP_U32 dictLength,
|
||||||
const XP_U8 const* end = ptr + dictLength;
|
const XP_U8 const* end = ptr + dictLength;
|
||||||
XP_U32 offset;
|
XP_U32 offset;
|
||||||
XP_U16 nFaces, numFaceBytes = 0;
|
XP_U16 nFaces, numFaceBytes = 0;
|
||||||
XP_U16 i;
|
|
||||||
XP_U16 flags;
|
XP_U16 flags;
|
||||||
void* mappedBase = (void*)ptr;
|
void* mappedBase = (void*)ptr;
|
||||||
XP_U8 nodeSize;
|
XP_U8 nodeSize;
|
||||||
|
@ -420,10 +415,9 @@ parseDict( AndDictionaryCtxt* ctxt, XP_U8 const* ptr, XP_U32 dictLength,
|
||||||
} else {
|
} else {
|
||||||
XP_U8 tmp[nFaces*4]; /* should be enough... */
|
XP_U8 tmp[nFaces*4]; /* should be enough... */
|
||||||
XP_U16 nBytes = 0;
|
XP_U16 nBytes = 0;
|
||||||
XP_U16 ii;
|
|
||||||
/* Need to translate from iso-8859-n to utf8 */
|
/* Need to translate from iso-8859-n to utf8 */
|
||||||
CHECK_PTR( ptr, 2 * nFaces, end );
|
CHECK_PTR( ptr, 2 * nFaces, end );
|
||||||
for ( ii = 0; ii < nFaces; ++ii ) {
|
for ( int ii = 0; ii < nFaces; ++ii ) {
|
||||||
XP_UCHAR ch = ptr[1];
|
XP_UCHAR ch = ptr[1];
|
||||||
|
|
||||||
ptr += 2;
|
ptr += 2;
|
||||||
|
@ -445,9 +439,9 @@ parseDict( AndDictionaryCtxt* ctxt, XP_U8 const* ptr, XP_U32 dictLength,
|
||||||
ctxt->super.langCode = ptr[0] & 0x7F;
|
ctxt->super.langCode = ptr[0] & 0x7F;
|
||||||
ptr += 2; /* skip xloc header */
|
ptr += 2; /* skip xloc header */
|
||||||
CHECK_PTR( ptr, 2 * nFaces, end );
|
CHECK_PTR( ptr, 2 * nFaces, end );
|
||||||
for ( i = 0; i < nFaces*2; i += 2 ) {
|
for ( int ii = 0; ii < nFaces*2; ii += 2 ) {
|
||||||
ctxt->super.countsAndValues[i] = *ptr++;
|
ctxt->super.countsAndValues[ii] = *ptr++;
|
||||||
ctxt->super.countsAndValues[i+1] = *ptr++;
|
ctxt->super.countsAndValues[ii+1] = *ptr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !andLoadSpecialData( ctxt, &ptr, end ) ) {
|
if ( !andLoadSpecialData( ctxt, &ptr, end ) ) {
|
||||||
|
@ -492,11 +486,10 @@ and_dictionary_destroy( DictionaryCtxt* dict )
|
||||||
AndDictionaryCtxt* ctxt = (AndDictionaryCtxt*)dict;
|
AndDictionaryCtxt* ctxt = (AndDictionaryCtxt*)dict;
|
||||||
XP_LOGF( "%s(dict=%p); code=%x", __func__, ctxt, ctxt->dbgid );
|
XP_LOGF( "%s(dict=%p); code=%x", __func__, ctxt, ctxt->dbgid );
|
||||||
XP_U16 nSpecials = andCountSpecials( ctxt );
|
XP_U16 nSpecials = andCountSpecials( ctxt );
|
||||||
XP_U16 ii;
|
|
||||||
JNIEnv* env = ctxt->env;
|
JNIEnv* env = ctxt->env;
|
||||||
|
|
||||||
if ( !!ctxt->super.chars ) {
|
if ( !!ctxt->super.chars ) {
|
||||||
for ( ii = 0; ii < nSpecials; ++ii ) {
|
for ( int ii = 0; ii < nSpecials; ++ii ) {
|
||||||
XP_UCHAR* text = ctxt->super.chars[ii];
|
XP_UCHAR* text = ctxt->super.chars[ii];
|
||||||
if ( !!text ) {
|
if ( !!text ) {
|
||||||
XP_FREE( ctxt->super.mpool, text );
|
XP_FREE( ctxt->super.mpool, text );
|
||||||
|
@ -507,7 +500,7 @@ and_dictionary_destroy( DictionaryCtxt* dict )
|
||||||
XP_FREEP( ctxt->super.mpool, &ctxt->super.charEnds );
|
XP_FREEP( ctxt->super.mpool, &ctxt->super.charEnds );
|
||||||
|
|
||||||
if ( !!ctxt->super.bitmaps ) {
|
if ( !!ctxt->super.bitmaps ) {
|
||||||
for ( ii = 0; ii < nSpecials; ++ii ) {
|
for ( int ii = 0; ii < nSpecials; ++ii ) {
|
||||||
jobject bitmap = ctxt->super.bitmaps[ii].largeBM;
|
jobject bitmap = ctxt->super.bitmaps[ii].largeBM;
|
||||||
if ( !!bitmap ) {
|
if ( !!bitmap ) {
|
||||||
(*env)->DeleteGlobalRef( env, bitmap );
|
(*env)->DeleteGlobalRef( env, bitmap );
|
||||||
|
@ -576,11 +569,10 @@ makeDicts( MPFORMAL JNIEnv *env, DictMgrCtxt* dictMgr, JNIUtilCtxt* jniutil,
|
||||||
jobjectArray jnames, jobjectArray jdicts, jobjectArray jpaths,
|
jobjectArray jnames, jobjectArray jdicts, jobjectArray jpaths,
|
||||||
jstring jlang )
|
jstring jlang )
|
||||||
{
|
{
|
||||||
int ii;
|
|
||||||
jsize len = (*env)->GetArrayLength( env, jdicts );
|
jsize len = (*env)->GetArrayLength( env, jdicts );
|
||||||
XP_ASSERT( len == (*env)->GetArrayLength( env, jnames ) );
|
XP_ASSERT( len == (*env)->GetArrayLength( env, jnames ) );
|
||||||
|
|
||||||
for ( ii = 0; ii <= VSIZE(dicts->dicts); ++ii ) {
|
for ( int ii = 0; ii <= VSIZE(dicts->dicts); ++ii ) {
|
||||||
DictionaryCtxt* dict = NULL;
|
DictionaryCtxt* dict = NULL;
|
||||||
if ( ii < len ) {
|
if ( ii < len ) {
|
||||||
jobject jdict = (*env)->GetObjectArrayElement( env, jdicts, ii );
|
jobject jdict = (*env)->GetObjectArrayElement( env, jdicts, ii );
|
||||||
|
|
|
@ -41,8 +41,7 @@ XP_U32
|
||||||
and_ntohl(XP_U32 ll)
|
and_ntohl(XP_U32 ll)
|
||||||
{
|
{
|
||||||
XP_U32 result = 0L;
|
XP_U32 result = 0L;
|
||||||
int ii;
|
for ( int ii = 0; ii < 4; ++ii ) {
|
||||||
for ( ii = 0; ii < 4; ++ii ) {
|
|
||||||
result <<= 8;
|
result <<= 8;
|
||||||
result |= ll & 0x000000FF;
|
result |= ll & 0x000000FF;
|
||||||
ll >>= 8;
|
ll >>= 8;
|
||||||
|
@ -91,8 +90,7 @@ getInt( JNIEnv* env, jobject obj, const char* name )
|
||||||
void
|
void
|
||||||
getInts( JNIEnv* env, void* cobj, jobject jobj, const SetInfo* sis, XP_U16 nSis )
|
getInts( JNIEnv* env, void* cobj, jobject jobj, const SetInfo* sis, XP_U16 nSis )
|
||||||
{
|
{
|
||||||
int ii;
|
for ( int ii = 0; ii < nSis; ++ii ) {
|
||||||
for ( ii = 0; ii < nSis; ++ii ) {
|
|
||||||
const SetInfo* si = &sis[ii];
|
const SetInfo* si = &sis[ii];
|
||||||
uint8_t* ptr = ((uint8_t*)cobj) + si->offset;
|
uint8_t* ptr = ((uint8_t*)cobj) + si->offset;
|
||||||
int val = getInt( env, jobj, si->name );
|
int val = getInt( env, jobj, si->name );
|
||||||
|
@ -126,8 +124,7 @@ setInt( JNIEnv* env, jobject obj, const char* name, int value )
|
||||||
void
|
void
|
||||||
setInts( JNIEnv* env, jobject jobj, void* cobj, const SetInfo* sis, XP_U16 nSis )
|
setInts( JNIEnv* env, jobject jobj, void* cobj, const SetInfo* sis, XP_U16 nSis )
|
||||||
{
|
{
|
||||||
int ii;
|
for ( int ii = 0; ii < nSis; ++ii ) {
|
||||||
for ( ii = 0; ii < nSis; ++ii ) {
|
|
||||||
const SetInfo* si = &sis[ii];
|
const SetInfo* si = &sis[ii];
|
||||||
uint8_t* ptr = ((uint8_t*)cobj) + si->offset;
|
uint8_t* ptr = ((uint8_t*)cobj) + si->offset;
|
||||||
int val;
|
int val;
|
||||||
|
@ -169,8 +166,7 @@ setBool( JNIEnv* env, jobject obj, const char* name, bool value )
|
||||||
void
|
void
|
||||||
setBools( JNIEnv* env, jobject jobj, void* cobj, const SetInfo* sis, XP_U16 nSis )
|
setBools( JNIEnv* env, jobject jobj, void* cobj, const SetInfo* sis, XP_U16 nSis )
|
||||||
{
|
{
|
||||||
int ii;
|
for ( int ii = 0; ii < nSis; ++ii ) {
|
||||||
for ( ii = 0; ii < nSis; ++ii ) {
|
|
||||||
const SetInfo* si = &sis[ii];
|
const SetInfo* si = &sis[ii];
|
||||||
XP_Bool val = *(XP_Bool*)(((uint8_t*)cobj)+si->offset);
|
XP_Bool val = *(XP_Bool*)(((uint8_t*)cobj)+si->offset);
|
||||||
setBool( env, jobj, si->name, val );
|
setBool( env, jobj, si->name, val );
|
||||||
|
@ -278,8 +274,7 @@ getBool( JNIEnv* env, jobject obj, const char* name )
|
||||||
void
|
void
|
||||||
getBools( JNIEnv* env, void* cobj, jobject jobj, const SetInfo* sis, XP_U16 nSis )
|
getBools( JNIEnv* env, void* cobj, jobject jobj, const SetInfo* sis, XP_U16 nSis )
|
||||||
{
|
{
|
||||||
int ii;
|
for ( int ii = 0; ii < nSis; ++ii ) {
|
||||||
for ( ii = 0; ii < nSis; ++ii ) {
|
|
||||||
const SetInfo* si = &sis[ii];
|
const SetInfo* si = &sis[ii];
|
||||||
XP_Bool val = getBool( env, jobj, si->name );
|
XP_Bool val = getBool( env, jobj, si->name );
|
||||||
*(XP_Bool*)(((uint8_t*)cobj)+si->offset) = val;
|
*(XP_Bool*)(((uint8_t*)cobj)+si->offset) = val;
|
||||||
|
@ -380,8 +375,7 @@ makeStringArray( JNIEnv *env, int siz, const XP_UCHAR** vals )
|
||||||
jobjectArray jarray = (*env)->NewObjectArray( env, siz, clas, empty );
|
jobjectArray jarray = (*env)->NewObjectArray( env, siz, clas, empty );
|
||||||
deleteLocalRefs( env, clas, empty, DELETE_NO_REF );
|
deleteLocalRefs( env, clas, empty, DELETE_NO_REF );
|
||||||
|
|
||||||
int ii;
|
for ( int ii = 0; !!vals && ii < siz; ++ii ) {
|
||||||
for ( ii = 0; !!vals && ii < siz; ++ii ) {
|
|
||||||
jstring jstr = (*env)->NewStringUTF( env, vals[ii] );
|
jstring jstr = (*env)->NewStringUTF( env, vals[ii] );
|
||||||
(*env)->SetObjectArrayElement( env, jarray, ii, jstr );
|
(*env)->SetObjectArrayElement( env, jarray, ii, jstr );
|
||||||
deleteLocalRef( env, jstr );
|
deleteLocalRef( env, jstr );
|
||||||
|
|
|
@ -86,7 +86,6 @@ readJRect( JNIEnv* env, XP_Rect* rect, jobject jrect )
|
||||||
static jobject
|
static jobject
|
||||||
makeJRects( AndDraw* draw, int indx, XP_U16 nPlayers, const XP_Rect rects[] )
|
makeJRects( AndDraw* draw, int indx, XP_U16 nPlayers, const XP_Rect rects[] )
|
||||||
{
|
{
|
||||||
XP_U16 ii;
|
|
||||||
JNIEnv* env = ENVFORME( draw->ti );
|
JNIEnv* env = ENVFORME( draw->ti );
|
||||||
jobject jrects = draw->jCache[indx];
|
jobject jrects = draw->jCache[indx];
|
||||||
if ( !jrects ) {
|
if ( !jrects ) {
|
||||||
|
@ -98,7 +97,7 @@ makeJRects( AndDraw* draw, int indx, XP_U16 nPlayers, const XP_Rect rects[] )
|
||||||
jmethodID initId = (*env)->GetMethodID( env, rclass, "<init>",
|
jmethodID initId = (*env)->GetMethodID( env, rclass, "<init>",
|
||||||
"()V" );
|
"()V" );
|
||||||
|
|
||||||
for ( ii = 0; ii < nPlayers; ++ii ) {
|
for ( int ii = 0; ii < nPlayers; ++ii ) {
|
||||||
jobject jrect = (*env)->NewObject( env, rclass, initId );
|
jobject jrect = (*env)->NewObject( env, rclass, initId );
|
||||||
(*env)->SetObjectArrayElement( env, jrects, ii, jrect );
|
(*env)->SetObjectArrayElement( env, jrects, ii, jrect );
|
||||||
deleteLocalRef( env, jrect );
|
deleteLocalRef( env, jrect );
|
||||||
|
@ -121,7 +120,6 @@ makeJRects( AndDraw* draw, int indx, XP_U16 nPlayers, const XP_Rect rects[] )
|
||||||
static jobject
|
static jobject
|
||||||
makeDSIs( AndDraw* draw, int indx, XP_U16 nPlayers, const DrawScoreInfo dsis[] )
|
makeDSIs( AndDraw* draw, int indx, XP_U16 nPlayers, const DrawScoreInfo dsis[] )
|
||||||
{
|
{
|
||||||
XP_U16 ii;
|
|
||||||
JNIEnv* env = ENVFORME( draw->ti );
|
JNIEnv* env = ENVFORME( draw->ti );
|
||||||
jobject dsiobjs = draw->jCache[indx];
|
jobject dsiobjs = draw->jCache[indx];
|
||||||
|
|
||||||
|
@ -133,7 +131,7 @@ makeDSIs( AndDraw* draw, int indx, XP_U16 nPlayers, const DrawScoreInfo dsis[] )
|
||||||
dsiobjs = draw->jCache[indx];
|
dsiobjs = draw->jCache[indx];
|
||||||
|
|
||||||
jmethodID initId = (*env)->GetMethodID( env, clas, "<init>", "()V" );
|
jmethodID initId = (*env)->GetMethodID( env, clas, "<init>", "()V" );
|
||||||
for ( ii = 0; ii < nPlayers; ++ii ) {
|
for ( int ii = 0; ii < nPlayers; ++ii ) {
|
||||||
jobject dsiobj = (*env)->NewObject( env, clas, initId );
|
jobject dsiobj = (*env)->NewObject( env, clas, initId );
|
||||||
(*env)->SetObjectArrayElement( env, dsiobjs, ii, dsiobj );
|
(*env)->SetObjectArrayElement( env, dsiobjs, ii, dsiobj );
|
||||||
deleteLocalRef( env, dsiobj );
|
deleteLocalRef( env, dsiobj );
|
||||||
|
@ -142,7 +140,7 @@ makeDSIs( AndDraw* draw, int indx, XP_U16 nPlayers, const DrawScoreInfo dsis[] )
|
||||||
deleteLocalRef( env, clas );
|
deleteLocalRef( env, clas );
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( ii = 0; ii < nPlayers; ++ii ) {
|
for ( int ii = 0; ii < nPlayers; ++ii ) {
|
||||||
jobject dsiobj = (*env)->GetObjectArrayElement( env, dsiobjs, ii );
|
jobject dsiobj = (*env)->GetObjectArrayElement( env, dsiobjs, ii );
|
||||||
const DrawScoreInfo* dsi = &dsis[ii];
|
const DrawScoreInfo* dsi = &dsis[ii];
|
||||||
|
|
||||||
|
@ -206,8 +204,8 @@ and_draw_scoreBegin( DrawCtx* dctx, const XP_Rect* rect,
|
||||||
DRAW_CBK_HEADER("scoreBegin", "(Landroid/graphics/Rect;I[II)Z" );
|
DRAW_CBK_HEADER("scoreBegin", "(Landroid/graphics/Rect;I[II)Z" );
|
||||||
|
|
||||||
jint jarr[numPlayers];
|
jint jarr[numPlayers];
|
||||||
int ii;
|
|
||||||
for ( ii = 0; ii < numPlayers; ++ii ) {
|
for ( int ii = 0; ii < numPlayers; ++ii ) {
|
||||||
jarr[ii] = scores[ii];
|
jarr[ii] = scores[ii];
|
||||||
}
|
}
|
||||||
jintArray jscores = makeIntArray( env, numPlayers, jarr );
|
jintArray jscores = makeIntArray( env, numPlayers, jarr );
|
||||||
|
@ -241,7 +239,6 @@ and_draw_score_drawPlayers( DrawCtx* dctx, const XP_Rect* scoreRect,
|
||||||
XP_U16 nPlayers, DrawScoreInfo playerData[],
|
XP_U16 nPlayers, DrawScoreInfo playerData[],
|
||||||
XP_Rect playerRects[] )
|
XP_Rect playerRects[] )
|
||||||
{
|
{
|
||||||
XP_U16 ii;
|
|
||||||
DRAW_CBK_HEADER("score_drawPlayers", "(Landroid/graphics/Rect;"
|
DRAW_CBK_HEADER("score_drawPlayers", "(Landroid/graphics/Rect;"
|
||||||
"[L" PKG_PATH("jni/DrawScoreInfo;")
|
"[L" PKG_PATH("jni/DrawScoreInfo;")
|
||||||
"[Landroid/graphics/Rect;)V" );
|
"[Landroid/graphics/Rect;)V" );
|
||||||
|
@ -251,7 +248,7 @@ and_draw_score_drawPlayers( DrawCtx* dctx, const XP_Rect* scoreRect,
|
||||||
jobject jrects = makeJRects( draw, JCACHE_RECTS, nPlayers, NULL );
|
jobject jrects = makeJRects( draw, JCACHE_RECTS, nPlayers, NULL );
|
||||||
(*env)->CallVoidMethod( env, draw->jdraw, mid, jrect, jdsis, jrects );
|
(*env)->CallVoidMethod( env, draw->jdraw, mid, jrect, jdsis, jrects );
|
||||||
|
|
||||||
for ( ii = 0; ii < nPlayers; ++ii ) {
|
for ( int ii = 0; ii < nPlayers; ++ii ) {
|
||||||
jobject jrect = (*env)->GetObjectArrayElement( env, jrects, ii );
|
jobject jrect = (*env)->GetObjectArrayElement( env, jrects, ii );
|
||||||
readJRect( env, &playerRects[ii], jrect );
|
readJRect( env, &playerRects[ii], jrect );
|
||||||
}
|
}
|
||||||
|
@ -611,8 +608,7 @@ makeDraw( MPFORMAL EnvThreadInfo* ti, jobject jdraw )
|
||||||
draw->ti = ti;
|
draw->ti = ti;
|
||||||
MPASSIGN( draw->mpool, mpool );
|
MPASSIGN( draw->mpool, mpool );
|
||||||
|
|
||||||
int ii;
|
for ( int ii = 0; ii < sizeof(*draw->vtable)/4; ++ii ) {
|
||||||
for ( ii = 0; ii < sizeof(*draw->vtable)/4; ++ii ) {
|
|
||||||
((void**)(draw->vtable))[ii] = draw_doNothing;
|
((void**)(draw->vtable))[ii] = draw_doNothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -664,8 +660,7 @@ destroyDraw( DrawCtx** dctx )
|
||||||
(*env)->DeleteGlobalRef( env, draw->jdraw );
|
(*env)->DeleteGlobalRef( env, draw->jdraw );
|
||||||
}
|
}
|
||||||
|
|
||||||
int ii;
|
for ( int ii = 0; ii < JCACHE_COUNT; ++ii ) {
|
||||||
for ( ii = 0; ii < JCACHE_COUNT; ++ii ) {
|
|
||||||
jobject jobj = draw->jCache[ii];
|
jobject jobj = draw->jCache[ii];
|
||||||
if ( !!jobj ) {
|
if ( !!jobj ) {
|
||||||
(*env)->DeleteGlobalRef( env, jobj );
|
(*env)->DeleteGlobalRef( env, jobj );
|
||||||
|
|
|
@ -745,8 +745,7 @@ destroyUtil( XW_UtilCtxt** utilc )
|
||||||
AndUtil* util = (AndUtil*)*utilc;
|
AndUtil* util = (AndUtil*)*utilc;
|
||||||
JNIEnv* env = ENVFORME( util->ti );
|
JNIEnv* env = ENVFORME( util->ti );
|
||||||
|
|
||||||
int ii;
|
for ( int ii = 0; ii < VSIZE(util->userStrings); ++ii ) {
|
||||||
for ( ii = 0; ii < VSIZE(util->userStrings); ++ii ) {
|
|
||||||
XP_UCHAR* ptr = util->userStrings[ii];
|
XP_UCHAR* ptr = util->userStrings[ii];
|
||||||
if ( NULL != ptr ) {
|
if ( NULL != ptr ) {
|
||||||
XP_FREE( util->util.mpool, ptr );
|
XP_FREE( util->util.mpool, ptr );
|
||||||
|
|
|
@ -241,8 +241,7 @@ makeGI( MPFORMAL JNIEnv* env, jobject jgi )
|
||||||
jobject jplayers;
|
jobject jplayers;
|
||||||
if ( getObject( env, jgi, "players", "[L" PKG_PATH("jni/LocalPlayer") ";",
|
if ( getObject( env, jgi, "players", "[L" PKG_PATH("jni/LocalPlayer") ";",
|
||||||
&jplayers ) ) {
|
&jplayers ) ) {
|
||||||
int ii;
|
for ( int ii = 0; ii < gi->nPlayers; ++ii ) {
|
||||||
for ( ii = 0; ii < gi->nPlayers; ++ii ) {
|
|
||||||
LocalPlayer* lp = &gi->players[ii];
|
LocalPlayer* lp = &gi->players[ii];
|
||||||
|
|
||||||
jobject jlp = (*env)->GetObjectArrayElement( env, jplayers, ii );
|
jobject jlp = (*env)->GetObjectArrayElement( env, jplayers, ii );
|
||||||
|
@ -288,8 +287,7 @@ setJGI( JNIEnv* env, jobject jgi, const CurGameInfo* gi )
|
||||||
if ( getObject( env, jgi, "players",
|
if ( getObject( env, jgi, "players",
|
||||||
"[L" PKG_PATH("jni/LocalPlayer") ";",
|
"[L" PKG_PATH("jni/LocalPlayer") ";",
|
||||||
&jplayers ) ) {
|
&jplayers ) ) {
|
||||||
int ii;
|
for ( int ii = 0; ii < gi->nPlayers; ++ii ) {
|
||||||
for ( ii = 0; ii < gi->nPlayers; ++ii ) {
|
|
||||||
const LocalPlayer* lp = &gi->players[ii];
|
const LocalPlayer* lp = &gi->players[ii];
|
||||||
|
|
||||||
jobject jlp = (*env)->GetObjectArrayElement( env, jplayers, ii );
|
jobject jlp = (*env)->GetObjectArrayElement( env, jplayers, ii );
|
||||||
|
@ -1345,7 +1343,6 @@ Java_org_eehouse_android_xw4_jni_XwJNI_comms_1getAddrs
|
||||||
( JNIEnv* env, jclass C, jint gamePtr )
|
( JNIEnv* env, jclass C, jint gamePtr )
|
||||||
{
|
{
|
||||||
jobjectArray result = NULL;
|
jobjectArray result = NULL;
|
||||||
XP_U16 ii;
|
|
||||||
XWJNI_START();
|
XWJNI_START();
|
||||||
XP_ASSERT( state->game.comms );
|
XP_ASSERT( state->game.comms );
|
||||||
CommsAddrRec addrs[MAX_NUM_PLAYERS];
|
CommsAddrRec addrs[MAX_NUM_PLAYERS];
|
||||||
|
@ -1356,7 +1353,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_comms_1getAddrs
|
||||||
result = (*env)->NewObjectArray( env, count, clas, NULL );
|
result = (*env)->NewObjectArray( env, count, clas, NULL );
|
||||||
|
|
||||||
jmethodID initId = (*env)->GetMethodID( env, clas, "<init>", "()V" );
|
jmethodID initId = (*env)->GetMethodID( env, clas, "<init>", "()V" );
|
||||||
for ( ii = 0; ii < count; ++ii ) {
|
for ( int ii = 0; ii < count; ++ii ) {
|
||||||
jobject jaddr = (*env)->NewObject( env, clas, initId );
|
jobject jaddr = (*env)->NewObject( env, clas, initId );
|
||||||
setJAddrRec( env, jaddr, &addrs[ii] );
|
setJAddrRec( env, jaddr, &addrs[ii] );
|
||||||
(*env)->SetObjectArrayElement( env, result, ii, jaddr );
|
(*env)->SetObjectArrayElement( env, result, ii, jaddr );
|
||||||
|
@ -1411,8 +1408,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_game_1receiveMessage
|
||||||
I'm a robot. Only one server_do and I'll never make that first
|
I'm a robot. Only one server_do and I'll never make that first
|
||||||
robot move. That's because comms can't detect a duplicate initial
|
robot move. That's because comms can't detect a duplicate initial
|
||||||
packet (in validateInitialMessage()). */
|
packet (in validateInitialMessage()). */
|
||||||
int ii;
|
for ( int ii = 0; ii < 5; ++ii ) {
|
||||||
for ( ii = 0; ii < 5; ++ii ) {
|
|
||||||
(void)server_do( server );
|
(void)server_do( server );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1471,9 +1467,8 @@ Java_org_eehouse_android_xw4_jni_XwJNI_game_1summarize
|
||||||
XP_U16 count = VSIZE(addrs);
|
XP_U16 count = VSIZE(addrs);
|
||||||
comms_getAddrs( comms, addrs, &count );
|
comms_getAddrs( comms, addrs, &count );
|
||||||
|
|
||||||
int ii;
|
|
||||||
const XP_UCHAR* addrps[count];
|
const XP_UCHAR* addrps[count];
|
||||||
for ( ii = 0; ii < count; ++ii ) {
|
for ( int ii = 0; ii < count; ++ii ) {
|
||||||
addrps[ii] = isBT ? (XP_UCHAR*)&addrs[ii].u.bt.btAddr :
|
addrps[ii] = isBT ? (XP_UCHAR*)&addrs[ii].u.bt.btAddr :
|
||||||
(XP_UCHAR*)&addrs[ii].u.sms.phone;
|
(XP_UCHAR*)&addrs[ii].u.sms.phone;
|
||||||
XP_LOGF( "%s: adding btaddr/phone %s", __func__, addrps[ii] );
|
XP_LOGF( "%s: adding btaddr/phone %s", __func__, addrps[ii] );
|
||||||
|
@ -1493,15 +1488,14 @@ Java_org_eehouse_android_xw4_jni_XwJNI_game_1summarize
|
||||||
|
|
||||||
XP_U16 nPlayers = model_getNPlayers( model );
|
XP_U16 nPlayers = model_getNPlayers( model );
|
||||||
jint jvals[nPlayers];
|
jint jvals[nPlayers];
|
||||||
int ii;
|
|
||||||
if ( gameOver ) {
|
if ( gameOver ) {
|
||||||
ScoresArray scores;
|
ScoresArray scores;
|
||||||
model_figureFinalScores( model, &scores, NULL );
|
model_figureFinalScores( model, &scores, NULL );
|
||||||
for ( ii = 0; ii < nPlayers; ++ii ) {
|
for ( int ii = 0; ii < nPlayers; ++ii ) {
|
||||||
jvals[ii] = scores.arr[ii];
|
jvals[ii] = scores.arr[ii];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for ( ii = 0; ii < nPlayers; ++ii ) {
|
for ( int ii = 0; ii < nPlayers; ++ii ) {
|
||||||
jvals[ii] = model_getPlayerScore( model, ii );
|
jvals[ii] = model_getPlayerScore( model, ii );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1906,9 +1900,8 @@ Java_org_eehouse_android_xw4_jni_XwJNI_dict_1iter_1getPrefixes
|
||||||
if ( NULL != data && NULL != data->idata.prefixes ) {
|
if ( NULL != data && NULL != data->idata.prefixes ) {
|
||||||
result = makeStringArray( env, data->idata.count, NULL );
|
result = makeStringArray( env, data->idata.count, NULL );
|
||||||
|
|
||||||
int ii;
|
|
||||||
XP_U16 depth = data->depth;
|
XP_U16 depth = data->depth;
|
||||||
for ( ii = 0; ii < data->idata.count; ++ii ) {
|
for ( int ii = 0; ii < data->idata.count; ++ii ) {
|
||||||
XP_UCHAR buf[16];
|
XP_UCHAR buf[16];
|
||||||
(void)dict_tilesToString( data->dict,
|
(void)dict_tilesToString( data->dict,
|
||||||
&data->idata.prefixes[depth*ii],
|
&data->idata.prefixes[depth*ii],
|
||||||
|
|
Loading…
Add table
Reference in a new issue