cleanup stuff noted in code review -- no behavior change

This commit is contained in:
Eric House 2024-01-17 13:34:34 -08:00
parent 6f0bfe2c82
commit 3670af591b
13 changed files with 27 additions and 58 deletions

View file

@ -1581,16 +1581,6 @@ public class BoardDelegate extends DelegateBase
callInviteChoices(); callInviteChoices();
} }
// @Override
// public void onInfoClicked( SentInvitesInfo sentInfo )
// {
// String msg = sentInfo.getAsText( m_activity );
// makeOkOnlyBuilder( msg )
// .setTitle( R.string.title_invite_history )
// .setAction( Action.INVITE_INFO )
// .show();
// }
@Override @Override
public long getRowID() public long getRowID()
{ {

View file

@ -199,7 +199,6 @@ public class DBUtils {
tmpInt = cursor.getInt( cursor.getColumnIndex( DBHelper.CAN_REMATCH )); tmpInt = cursor.getInt( cursor.getColumnIndex( DBHelper.CAN_REMATCH ));
summary.canRematch = 0 != (1 & tmpInt); summary.canRematch = 0 != (1 & tmpInt);
summary.canOfferRO = 0 != (2 & tmpInt);
String str = cursor String str = cursor
.getString(cursor.getColumnIndex(DBHelper.EXTRAS)); .getString(cursor.getColumnIndex(DBHelper.EXTRAS));
@ -311,8 +310,7 @@ public class DBUtils {
values.put( DBHelper.QUASHED, summary.quashed? 1 : 0 ); values.put( DBHelper.QUASHED, summary.quashed? 1 : 0 );
values.put( DBHelper.LASTMOVE, summary.lastMoveTime ); values.put( DBHelper.LASTMOVE, summary.lastMoveTime );
values.put( DBHelper.NEXTDUPTIMER, summary.dupTimerExpires ); values.put( DBHelper.NEXTDUPTIMER, summary.dupTimerExpires );
int tmpInt = (summary.canRematch? 1 : 0) | (summary.canOfferRO? 2 : 0); values.put( DBHelper.CAN_REMATCH, summary.canRematch? 1 : 0 );
values.put( DBHelper.CAN_REMATCH, tmpInt );
// Don't overwrite extras! Sometimes this method is called from // Don't overwrite extras! Sometimes this method is called from
// JNIThread which has created the summary from common code that // JNIThread which has created the summary from common code that

View file

@ -67,7 +67,6 @@ import org.eehouse.android.xw4.jni.CurGameInfo;
import org.eehouse.android.xw4.jni.GameSummary; import org.eehouse.android.xw4.jni.GameSummary;
import org.eehouse.android.xw4.jni.LastMoveInfo; import org.eehouse.android.xw4.jni.LastMoveInfo;
import org.eehouse.android.xw4.jni.XwJNI; import org.eehouse.android.xw4.jni.XwJNI;
import org.eehouse.android.xw4.jni.XwJNI.RematchOrder;
import org.eehouse.android.xw4.loc.LocUtils; import org.eehouse.android.xw4.loc.LocUtils;
import static org.eehouse.android.xw4.DBUtils.ROWID_NOTFOUND; import static org.eehouse.android.xw4.DBUtils.ROWID_NOTFOUND;

View file

@ -128,7 +128,6 @@ class InvitesNeededAlert {
long getRowID(); long getRowID();
void onCloseClicked(); void onCloseClicked();
void onInviteClicked(); void onInviteClicked();
// void onInfoClicked( SentInvitesInfo sentInfo );
} }
private boolean close() private boolean close()

View file

@ -24,9 +24,6 @@ import android.content.Context;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.View; import android.view.View;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.AdapterView;
import android.widget.CheckBox;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.RadioButton; import android.widget.RadioButton;
import android.widget.RadioGroup; import android.widget.RadioGroup;
@ -113,7 +110,6 @@ public class RematchConfigView extends LinearLayout
} }
} else { } else {
mNameStr = TextUtils.join( mSep, mWrapper.gi().playerNames(mNewOrder) ); mNameStr = TextUtils.join( mSep, mWrapper.gi().playerNames(mNewOrder) );
Log.d( TAG, "mNameStr: %s", mNameStr );
mEWC.setText( mNameStr ); mEWC.setText( mNameStr );
} }
} }
@ -149,5 +145,4 @@ public class RematchConfigView extends LinearLayout
} }
} }
} }
} }

View file

@ -85,7 +85,6 @@ public class GameSummary implements Serializable {
public DeviceRole serverRole; public DeviceRole serverRole;
public int nPacketsPending; public int nPacketsPending;
public boolean canRematch; public boolean canRematch;
public boolean canOfferRO;
private Integer m_giFlags; private Integer m_giFlags;
private String m_playersSummary; private String m_playersSummary;

View file

@ -28,12 +28,6 @@
android:focusable="false" android:focusable="false"
/> />
<LinearLayout android:id="@+id/ro_stuff"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<TextView android:id="@+id/explanation" <TextView android:id="@+id/explanation"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -46,6 +40,5 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
/> />
</LinearLayout>
</org.eehouse.android.xw4.RematchConfigView> </org.eehouse.android.xw4.RematchConfigView>

View file

@ -400,12 +400,13 @@ makeBooleanArray( JNIEnv* env, int siz, const jboolean* vals )
int int
getIntsFromArray( JNIEnv* env, int dest[], jintArray arr, int count, bool del ) getIntsFromArray( JNIEnv* env, int dest[], jintArray arr, int count, bool del )
{ {
jint* ints = (*env)->GetIntArrayElements(env, arr, 0); {
jsize len = (*env)->GetArrayLength( env, arr ); jsize len = (*env)->GetArrayLength( env, arr );
if ( len < count ) { if ( len < count ) {
count = len; count = len;
} }
}
jint* ints = (*env)->GetIntArrayElements(env, arr, 0);
for ( int ii = 0; ii < count; ++ii ) { for ( int ii = 0; ii < count; ++ii ) {
dest[ii] = ints[ii]; dest[ii] = ints[ii];
} }

View file

@ -2343,7 +2343,6 @@ Java_org_eehouse_android_xw4_jni_XwJNI_game_1summarize
setInt( env, jsummary, "turn", summary.turn ); setInt( env, jsummary, "turn", summary.turn );
setBool( env, jsummary, "turnIsLocal", summary.turnIsLocal ); setBool( env, jsummary, "turnIsLocal", summary.turnIsLocal );
setBool( env, jsummary, "canRematch", summary.canRematch ); setBool( env, jsummary, "canRematch", summary.canRematch );
setBool( env, jsummary, "canOfferRO", summary.canOfferRO );
setInt( env, jsummary, "lastMoveTime", summary.lastMoveTime ); setInt( env, jsummary, "lastMoveTime", summary.lastMoveTime );
setInt( env, jsummary, "dupTimerExpires", summary.dupTimerExpires ); setInt( env, jsummary, "dupTimerExpires", summary.dupTimerExpires );

View file

@ -2843,10 +2843,10 @@ validateInitialMessage( CommsCtxt* comms, XP_Bool XP_UNUSED_HEARTBEAT(hasPayload
const CommsAddrRec* retAddr, XWHostID senderID, const CommsAddrRec* retAddr, XWHostID senderID,
XP_PlayerAddr* channelNoP, XP_U16 flags, MsgID msgID ) XP_PlayerAddr* channelNoP, XP_U16 flags, MsgID msgID )
{ {
AddressRecord* rec = NULL;
CNO_FMT( cbuf, *channelNoP ); CNO_FMT( cbuf, *channelNoP );
COMMS_LOGFF( TAGFMT() "looking at %s", TAGPRMS, cbuf ); COMMS_LOGFF( TAGFMT() "looking at %s", TAGPRMS, cbuf );
rec = getRecordFor( comms, *channelNoP );
AddressRecord* rec = getRecordFor( comms, *channelNoP );
if ( !!rec ) { if ( !!rec ) {
augmentChannelAddr( comms, rec, retAddr, senderID ); augmentChannelAddr( comms, rec, retAddr, senderID );

View file

@ -213,8 +213,7 @@ game_makeNewGame( MPFORMAL XWEnv xwe, XWGame* game, CurGameInfo* gi,
game->server = server_make( MPPARM(mpool) xwe, game->model, game->server = server_make( MPPARM(mpool) xwe, game->model,
game->comms, game->comms, util );
util );
game->board = board_make( MPPARM(mpool) xwe, game->model, game->server, game->board = board_make( MPPARM(mpool) xwe, game->model, game->server,
NULL, util ); NULL, util );
board_setCallbacks( game->board, xwe ); board_setCallbacks( game->board, xwe );

View file

@ -183,7 +183,6 @@ drawScoreBoard( BoardCtxt* board, XWEnv xwe )
XP_U16 remWidth, remHeight, remDim; XP_U16 remWidth, remHeight, remDim;
DrawScoreData* dp; DrawScoreData* dp;
DrawScoreData datum[MAX_NUM_PLAYERS]; DrawScoreData datum[MAX_NUM_PLAYERS];
ScoresArray scores;
XP_Bool isVertical = !board->scoreSplitHor; XP_Bool isVertical = !board->scoreSplitHor;
XP_Bool remFocussed = XP_FALSE; XP_Bool remFocussed = XP_FALSE;
XP_Bool focusAll = XP_FALSE; XP_Bool focusAll = XP_FALSE;
@ -200,6 +199,7 @@ drawScoreBoard( BoardCtxt* board, XWEnv xwe )
#endif #endif
/* Get the scores from the model or by calculating them based on /* Get the scores from the model or by calculating them based on
the end-of-game state. */ the end-of-game state. */
ScoresArray scores;
model_getCurScores( model, &scores, board->gameOver ); model_getCurScores( model, &scores, board->gameOver );
if ( draw_scoreBegin( board->draw, xwe, &board->scoreBdBounds, if ( draw_scoreBegin( board->draw, xwe, &board->scoreBdBounds,

View file

@ -385,8 +385,7 @@ initServer( ServerCtxt* server, XWEnv xwe )
SRVR_LOGFF(" "); SRVR_LOGFF(" ");
setTurn( server, xwe, -1 ); /* game isn't under way yet */ setTurn( server, xwe, -1 ); /* game isn't under way yet */
if ( 0 ) { if ( server->vol.gi->serverRole == SERVER_ISCLIENT ) {
} else if ( server->vol.gi->serverRole == SERVER_ISCLIENT ) {
SETSTATE( server, XWSTATE_NONE ); SETSTATE( server, XWSTATE_NONE );
} else { } else {
SETSTATE( server, XWSTATE_BEGIN ); SETSTATE( server, XWSTATE_BEGIN );
@ -2197,7 +2196,6 @@ client_readInitialMessage( ServerCtxt* server, XWEnv xwe, XWStreamCtxt* stream )
} }
// XP_ASSERT( streamVersion <= CUR_STREAM_VERS ); /* else do what? */ // XP_ASSERT( streamVersion <= CUR_STREAM_VERS ); /* else do what? */
/* Get rid of this!!!! It's in the damned gi that's read next */
gameID = streamVersion < STREAM_VERS_REMATCHORDER gameID = streamVersion < STREAM_VERS_REMATCHORDER
? stream_getU32( stream ) : 0; ? stream_getU32( stream ) : 0;
CurGameInfo localGI = {0}; CurGameInfo localGI = {0};
@ -2208,10 +2206,10 @@ client_readInitialMessage( ServerCtxt* server, XWEnv xwe, XWStreamCtxt* stream )
/* never seems to replace anything -- gi is already correct on guests /* never seems to replace anything -- gi is already correct on guests
apparently. How? Will have come in with invitation, of course. */ apparently. How? Will have come in with invitation, of course. */
SRVR_LOGFF( "read gameID of %X/%d; calling comms_setConnID (replacing %X)", SRVR_LOGFF( "read gameID of %08X; calling comms_setConnID (replacing %08X)",
gameID, gameID, server->vol.gi->gameID ); gameID, gi->gameID );
XP_ASSERT( server->vol.gi->gameID == gameID ); XP_ASSERT( gi->gameID == gameID );
server->vol.gi->gameID = gameID; gi->gameID = gameID;
comms_setConnID( comms, gameID, streamVersion ); comms_setConnID( comms, gameID, streamVersion );
XP_ASSERT( !localGI.dictName ); XP_ASSERT( !localGI.dictName );
@ -3997,8 +3995,7 @@ finishMove( ServerCtxt* server, XWEnv xwe, TrayTileSet* newTiles, XP_U16 turn )
freeBWI( MPPARM(server->mpool) &server->illegalWordInfo ); freeBWI( MPPARM(server->mpool) &server->illegalWordInfo );
} }
if ( 0 ) { if (isClient && (gi->phoniesAction == PHONIES_DISALLOW)
} else if (isClient && (gi->phoniesAction == PHONIES_DISALLOW)
&& nTilesMoved > 0 ) { && nTilesMoved > 0 ) {
SETSTATE( server, XWSTATE_MOVE_CONFIRM_WAIT ); SETSTATE( server, XWSTATE_MOVE_CONFIRM_WAIT );
setTurn( server, xwe, -1 ); setTurn( server, xwe, -1 );