Beispiel #1
0
static XP_S16
and_util_userPickTileTray( XW_UtilCtxt* uc, const PickInfo* pi, 
                           XP_U16 playerNum, const XP_UCHAR** tileFaces, 
                           XP_U16 nTiles )
{
    XP_S16 result = -1;
    UTIL_CBK_HEADER("userPickTileTray", 
                    "(I[Ljava/lang/String;[Ljava/lang/String;I)I" );
    jobject jtexts = makeStringArray( env, nTiles, tileFaces );
    jobject jcurtiles = makeStringArray( env, pi->nCurTiles, pi->curTiles );
    result = (*env)->CallIntMethod( env, util->jutil, mid, 
                                    playerNum, jtexts, jcurtiles, 
                                    pi->thisPick );
    deleteLocalRefs( env, jtexts, jcurtiles, DELETE_NO_REF );
        
    UTIL_CBK_TAIL();
    return result;
} /* and_util_userPickTile */
Beispiel #2
0
static XP_Bool
and_util_confirmTrade( XW_UtilCtxt* uc, const XP_UCHAR** tiles, XP_U16 nTiles )
{
    XP_Bool result = XP_FALSE;
    UTIL_CBK_HEADER("confirmTrade", "([Ljava/lang/String;)Z" );
    jobjectArray jtiles = makeStringArray( env, nTiles, tiles );
    result = (*env)->CallBooleanMethod( env, util->jutil, mid, jtiles );
    deleteLocalRef( env, jtiles );
    UTIL_CBK_TAIL();
    return result;
}
Beispiel #3
0
char *test_readtokens() {
	char **toks = makeStringArray(5, 10);
	char line[15] = "123,45678,0000";
	int count = readtokens(toks, line, ',');

	mu_assert("read token: count wrong", count == 3);
	mu_assert("read token: pos 0 wrong", strcmp(toks[0], "123") == 0);
	mu_assert("read token: pos 1 wrong", strcmp(toks[1], "45678") == 0);
	mu_assert("read token: pos 2 wrong", strcmp(toks[2], "0000") == 0);

	freeStringArray(toks, 5);

	return 0;
}
Beispiel #4
0
static XP_S16
and_util_userPickTileBlank( XW_UtilCtxt* uc, XP_U16 playerNum, 
                            const XP_UCHAR** tileFaces, XP_U16 nTiles )
{
    XP_S16 result = -1;
    UTIL_CBK_HEADER("userPickTileBlank", "(I[Ljava/lang/String;)I" );

    jobject jtexts = makeStringArray( env, nTiles, tileFaces );

    result = (*env)->CallIntMethod( env, util->jutil, mid, 
                                    playerNum, jtexts );

    deleteLocalRef( env, jtexts );
    UTIL_CBK_TAIL();
    return result;
}
Beispiel #5
0
static XP_Bool
and_util_warnIllegalWord( XW_UtilCtxt* uc, BadWordInfo* bwi, 
                          XP_U16 turn, XP_Bool turnLost )
{
    jboolean result = XP_FALSE;
    UTIL_CBK_HEADER("warnIllegalWord", 
                    "(Ljava/lang/String;[Ljava/lang/String;IZ)Z" );
    XP_ASSERT( bwi->nWords > 0 );
    if ( bwi->nWords > 0 ) {
        jobjectArray jwords = makeStringArray( env, bwi->nWords, 
                                               (const XP_UCHAR**)bwi->words );
        XP_ASSERT( !!bwi->dictName );
        jstring jname = (*env)->NewStringUTF( env, bwi->dictName );
        result = (*env)->CallBooleanMethod( env, util->jutil, mid,
                                            jname, jwords, turn, turnLost );
        deleteLocalRefs( env, jwords, jname, DELETE_NO_REF );
    }
    UTIL_CBK_TAIL();
    return result;
}