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();
}
// @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
public long getRowID()
{

View file

@ -199,7 +199,6 @@ public class DBUtils {
tmpInt = cursor.getInt( cursor.getColumnIndex( DBHelper.CAN_REMATCH ));
summary.canRematch = 0 != (1 & tmpInt);
summary.canOfferRO = 0 != (2 & tmpInt);
String str = cursor
.getString(cursor.getColumnIndex(DBHelper.EXTRAS));
@ -311,8 +310,7 @@ public class DBUtils {
values.put( DBHelper.QUASHED, summary.quashed? 1 : 0 );
values.put( DBHelper.LASTMOVE, summary.lastMoveTime );
values.put( DBHelper.NEXTDUPTIMER, summary.dupTimerExpires );
int tmpInt = (summary.canRematch? 1 : 0) | (summary.canOfferRO? 2 : 0);
values.put( DBHelper.CAN_REMATCH, tmpInt );
values.put( DBHelper.CAN_REMATCH, summary.canRematch? 1 : 0 );
// Don't overwrite extras! Sometimes this method is called from
// 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.LastMoveInfo;
import org.eehouse.android.xw4.jni.XwJNI;
import org.eehouse.android.xw4.jni.XwJNI.RematchOrder;
import org.eehouse.android.xw4.loc.LocUtils;
import static org.eehouse.android.xw4.DBUtils.ROWID_NOTFOUND;

View file

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

View file

@ -24,9 +24,6 @@ import android.content.Context;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.View;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.AdapterView;
import android.widget.CheckBox;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;
@ -113,7 +110,6 @@ public class RematchConfigView extends LinearLayout
}
} else {
mNameStr = TextUtils.join( mSep, mWrapper.gi().playerNames(mNewOrder) );
Log.d( TAG, "mNameStr: %s", 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 int nPacketsPending;
public boolean canRematch;
public boolean canOfferRO;
private Integer m_giFlags;
private String m_playersSummary;

View file

@ -28,24 +28,17 @@
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"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/expl_rematch_order"
/>
<TextView android:id="@+id/explanation"
android:layout_height="wrap_content"
<RadioGroup android:id="@+id/group"
android:orientation="vertical"
android:layout_width="match_parent"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/expl_rematch_order"
android:layout_height="wrap_content"
/>
<RadioGroup android:id="@+id/group"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
</org.eehouse.android.xw4.RematchConfigView>

View file

@ -400,12 +400,13 @@ makeBooleanArray( JNIEnv* env, int siz, const jboolean* vals )
int
getIntsFromArray( JNIEnv* env, int dest[], jintArray arr, int count, bool del )
{
jint* ints = (*env)->GetIntArrayElements(env, arr, 0);
jsize len = (*env)->GetArrayLength( env, arr );
if ( len < count ) {
count = len;
{
jsize len = (*env)->GetArrayLength( env, arr );
if ( len < count ) {
count = len;
}
}
jint* ints = (*env)->GetIntArrayElements(env, arr, 0);
for ( int ii = 0; ii < count; ++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 );
setBool( env, jsummary, "turnIsLocal", summary.turnIsLocal );
setBool( env, jsummary, "canRematch", summary.canRematch );
setBool( env, jsummary, "canOfferRO", summary.canOfferRO );
setInt( env, jsummary, "lastMoveTime", summary.lastMoveTime );
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,
XP_PlayerAddr* channelNoP, XP_U16 flags, MsgID msgID )
{
AddressRecord* rec = NULL;
CNO_FMT( cbuf, *channelNoP );
COMMS_LOGFF( TAGFMT() "looking at %s", TAGPRMS, cbuf );
rec = getRecordFor( comms, *channelNoP );
AddressRecord* rec = getRecordFor( comms, *channelNoP );
if ( !!rec ) {
augmentChannelAddr( comms, rec, retAddr, senderID );
@ -3700,7 +3700,7 @@ augmentAddrIntrnl( CommsCtxt* comms, CommsAddrRec* destAddr,
if ( !isNewer && !newType
&& 0 != XP_MEMCMP( &empty, dest, siz ) ) {
XP_LOGFF( "%s: not replacing new info with old",
ConnType2Str(typ) );
ConnType2Str(typ) );
} else {
XP_MEMCPY( dest, src, siz );
changed = XP_TRUE;

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->comms,
util );
game->comms, util );
game->board = board_make( MPPARM(mpool) xwe, game->model, game->server,
NULL, util );
board_setCallbacks( game->board, xwe );

View file

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

View file

@ -385,8 +385,7 @@ initServer( ServerCtxt* server, XWEnv xwe )
SRVR_LOGFF(" ");
setTurn( server, xwe, -1 ); /* game isn't under way yet */
if ( 0 ) {
} else if ( server->vol.gi->serverRole == SERVER_ISCLIENT ) {
if ( server->vol.gi->serverRole == SERVER_ISCLIENT ) {
SETSTATE( server, XWSTATE_NONE );
} else {
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? */
/* Get rid of this!!!! It's in the damned gi that's read next */
gameID = streamVersion < STREAM_VERS_REMATCHORDER
? stream_getU32( stream ) : 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
apparently. How? Will have come in with invitation, of course. */
SRVR_LOGFF( "read gameID of %X/%d; calling comms_setConnID (replacing %X)",
gameID, gameID, server->vol.gi->gameID );
XP_ASSERT( server->vol.gi->gameID == gameID );
server->vol.gi->gameID = gameID;
SRVR_LOGFF( "read gameID of %08X; calling comms_setConnID (replacing %08X)",
gameID, gi->gameID );
XP_ASSERT( gi->gameID == gameID );
gi->gameID = gameID;
comms_setConnID( comms, gameID, streamVersion );
XP_ASSERT( !localGI.dictName );
@ -3997,8 +3995,7 @@ finishMove( ServerCtxt* server, XWEnv xwe, TrayTileSet* newTiles, XP_U16 turn )
freeBWI( MPPARM(server->mpool) &server->illegalWordInfo );
}
if ( 0 ) {
} else if (isClient && (gi->phoniesAction == PHONIES_DISALLOW)
if (isClient && (gi->phoniesAction == PHONIES_DISALLOW)
&& nTilesMoved > 0 ) {
SETSTATE( server, XWSTATE_MOVE_CONFIRM_WAIT );
setTurn( server, xwe, -1 );