implement board_beginTrade()

This commit is contained in:
ehouse 2010-01-13 12:29:11 +00:00
parent 79c68c25ab
commit cf60be5082
4 changed files with 19 additions and 0 deletions

View file

@ -161,6 +161,9 @@ public class BoardActivity extends Activity implements XW_UtilCtxt, Runnable {
case R.id.board_menu_flip: case R.id.board_menu_flip:
m_jniThread.handle( JNIThread.JNICmd.CMD_FLIP ); m_jniThread.handle( JNIThread.JNICmd.CMD_FLIP );
break; break;
case R.id.board_menu_trade:
m_jniThread.handle( JNIThread.JNICmd.CMD_TOGGLE_TRADE );
break;
case R.id.board_menu_tray: case R.id.board_menu_tray:
m_jniThread.handle( JNIThread.JNICmd.CMD_TOGGLE_TRAY ); m_jniThread.handle( JNIThread.JNICmd.CMD_TOGGLE_TRAY );
break; break;

View file

@ -23,6 +23,7 @@ public class JNIThread extends Thread {
CMD_JUGGLE, CMD_JUGGLE,
CMD_FLIP, CMD_FLIP,
CMD_TOGGLE_TRAY, CMD_TOGGLE_TRAY,
CMD_TOGGLE_TRADE,
CMD_UNDO_CUR, CMD_UNDO_CUR,
CMD_UNDO_LAST, CMD_UNDO_LAST,
CMD_HINT, CMD_HINT,
@ -132,6 +133,9 @@ public class JNIThread extends Thread {
case CMD_TOGGLE_TRAY: case CMD_TOGGLE_TRAY:
draw = toggleTray(); draw = toggleTray();
break; break;
case CMD_TOGGLE_TRADE:
draw = XwJNI.board_beginTrade( m_jniGamePtr );
break;
case CMD_UNDO_CUR: case CMD_UNDO_CUR:
draw = XwJNI.board_replaceTiles( m_jniGamePtr ); draw = XwJNI.board_replaceTiles( m_jniGamePtr );
break; break;

View file

@ -71,6 +71,7 @@ public class XwJNI {
public static native void board_resetEngine( int gamePtr ); public static native void board_resetEngine( int gamePtr );
public static native boolean board_requestHint( int gamePtr, boolean useTileLimits, public static native boolean board_requestHint( int gamePtr, boolean useTileLimits,
boolean[] workRemains ); boolean[] workRemains );
public static native boolean board_beginTrade( int gamePtr );
public static native void server_handleUndo( int gamePtr ); public static native void server_handleUndo( int gamePtr );
public static native boolean server_do( int gamePtr ); public static native boolean server_do( int gamePtr );

View file

@ -445,6 +445,17 @@ Java_org_eehouse_android_xw4_jni_XwJNI_board_1showTray
return result; return result;
} }
JNIEXPORT jboolean JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_board_1beginTrade
( JNIEnv* env, jclass C, jint gamePtr )
{
jboolean result;
XWJNI_START();
result = board_beginTrade( state->game.board );
XWJNI_END();
return result;
}
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_board_1toggle_1showValues Java_org_eehouse_android_xw4_jni_XwJNI_board_1toggle_1showValues
( JNIEnv* env, jclass C, jint gamePtr ) ( JNIEnv* env, jclass C, jint gamePtr )