mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-30 10:26:58 +01:00
Merge branch 'relay_proxy' of ssh://xwords.git.sourceforge.net/gitroot/xwords/xwords into relay_proxy
This commit is contained in:
commit
ae53ce5ea9
8 changed files with 46 additions and 2 deletions
|
@ -355,6 +355,15 @@ and_util_remSelected(XW_UtilCtxt* uc)
|
|||
UTIL_CBK_TAIL();
|
||||
}
|
||||
|
||||
static void
|
||||
and_util_setIsServer(XW_UtilCtxt* uc, XP_Bool isServer )
|
||||
{
|
||||
/* Change both the C and Java structs, which need to stay in sync */
|
||||
uc->gameInfo->serverRole = isServer? SERVER_ISSERVER : SERVER_ISCLIENT;
|
||||
UTIL_CBK_HEADER("setIsServer", "(Z)V" );
|
||||
(*env)->CallVoidMethod( env, util->jutil, mid, isServer );
|
||||
UTIL_CBK_TAIL();
|
||||
}
|
||||
|
||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
||||
static void
|
||||
|
@ -437,6 +446,7 @@ makeUtil( MPFORMAL JNIEnv** envp, jobject jutil, CurGameInfo* gi,
|
|||
SET_PROC(getUserString);
|
||||
SET_PROC(warnIllegalWord);
|
||||
SET_PROC(remSelected);
|
||||
SET_PROC(setIsServer);
|
||||
|
||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
||||
SET_PROC(addrChange);
|
||||
|
|
|
@ -731,6 +731,15 @@ Java_org_eehouse_android_xw4_jni_XwJNI_board_1redoReplacedTiles
|
|||
return result;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_eehouse_android_xw4_jni_XwJNI_server_1reset
|
||||
(JNIEnv* env, jclass C, jint gamePtr )
|
||||
{
|
||||
XWJNI_START();
|
||||
server_reset( state->game.server, state->game.comms );
|
||||
XWJNI_END();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_eehouse_android_xw4_jni_XwJNI_server_1handleUndo
|
||||
(JNIEnv* env, jclass C, jint gamePtr)
|
||||
|
|
BIN
xwords4/android/XWords4/res/drawable/refresh.png
Normal file
BIN
xwords4/android/XWords4/res/drawable/refresh.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
|
@ -604,6 +604,21 @@ public class BoardActivity extends Activity implements UtilCtxt {
|
|||
R.string.tiles_left_title );
|
||||
}
|
||||
|
||||
public void setIsServer( boolean isServer )
|
||||
{
|
||||
Utils.logf( "setIsServer(%s)", isServer?"true":"false" );
|
||||
DeviceRole newRole = isServer? DeviceRole.SERVER_ISSERVER
|
||||
: DeviceRole.SERVER_ISCLIENT;
|
||||
if ( newRole != m_gi.serverRole ) {
|
||||
Utils.logf( "new role: %s; old role: %s",
|
||||
newRole.toString(), m_gi.serverRole.toString() );
|
||||
m_gi.serverRole = newRole;
|
||||
if ( !isServer ) {
|
||||
m_jniThread.handle( JNIThread.JNICmd.CMD_SWITCHCLIENT );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setTimer( int why, int when, int handle )
|
||||
{
|
||||
if ( null != m_timers[why] ) {
|
||||
|
|
|
@ -459,7 +459,7 @@ public class GameConfig extends Activity implements View.OnClickListener,
|
|||
m_notNetworkedGame = m_notNetworkedGameCheckbx.isChecked();
|
||||
m_gi.setServerRole( m_notNetworkedGame
|
||||
? DeviceRole.SERVER_STANDALONE
|
||||
: DeviceRole.SERVER_ISSERVER );
|
||||
: DeviceRole.SERVER_ISCLIENT );
|
||||
|
||||
loadPlayers();
|
||||
} else if ( m_joinPublicCheck == view ) {
|
||||
|
|
|
@ -44,6 +44,7 @@ public class JNIThread extends Thread {
|
|||
CMD_DRAW,
|
||||
CMD_LAYOUT,
|
||||
CMD_START,
|
||||
CMD_SWITCHCLIENT,
|
||||
CMD_RESET,
|
||||
CMD_SAVE,
|
||||
CMD_DO,
|
||||
|
@ -287,6 +288,13 @@ public class JNIThread extends Thread {
|
|||
}
|
||||
draw = XwJNI.server_do( m_jniGamePtr );
|
||||
break;
|
||||
|
||||
case CMD_SWITCHCLIENT:
|
||||
XwJNI.server_reset( m_jniGamePtr );
|
||||
XwJNI.server_initClientConnection( m_jniGamePtr );
|
||||
draw = XwJNI.server_do( m_jniGamePtr );
|
||||
break;
|
||||
|
||||
case CMD_DO:
|
||||
if ( nextSame( JNICmd.CMD_DO ) ) {
|
||||
continue;
|
||||
|
|
|
@ -45,9 +45,10 @@ public interface UtilCtxt {
|
|||
public static final int TIMER_SLOWROBOT = 4;
|
||||
void setTimer( int why, int when, int handle );
|
||||
void clearTimer( int why );
|
||||
|
||||
void requestTime();
|
||||
void remSelected();
|
||||
|
||||
void setIsServer( boolean isServer );
|
||||
|
||||
static final int STRD_ROBOT_TRADED = 1;
|
||||
static final int STR_ROBOT_MOVED = 2;
|
||||
|
|
|
@ -182,6 +182,7 @@ public class XwJNI {
|
|||
public static native int model_getNMoves( int gamePtr );
|
||||
|
||||
// Server
|
||||
public static native void server_reset( int gamePtr );
|
||||
public static native void server_handleUndo( int gamePtr );
|
||||
public static native boolean server_do( int gamePtr );
|
||||
public static native String server_formatDictCounts( int gamePtr, int nCols );
|
||||
|
|
Loading…
Reference in a new issue