tweak linux client to work with old test script

Included adding a new enum
This commit is contained in:
Eric House 2024-02-02 16:40:37 -08:00
parent 0d87cbc7d0
commit 5d53df9f0b
6 changed files with 20 additions and 14 deletions

View file

@ -137,12 +137,15 @@ public class RematchConfigView extends LinearLayout
RematchOrder lastSel = RematchOrder.values()[ordinal]; RematchOrder lastSel = RematchOrder.values()[ordinal];
for ( RematchOrder ro : RematchOrder.values() ) { for ( RematchOrder ro : RematchOrder.values() ) {
RadioButton button = new RadioButton( mContext ); int strId = ro.getStrID();
button.setText( LocUtils.getString( mContext, ro.getStrID() ) ); if ( 0 != strId ) {
mGroup.addView( button ); RadioButton button = new RadioButton( mContext );
mRos.put( button.getId(), ro ); button.setText( LocUtils.getString( mContext, strId ) );
if ( lastSel == ro ) { mGroup.addView( button );
button.setChecked( true ); mRos.put( button.getId(), ro );
if ( lastSel == ro ) {
button.setChecked( true );
}
} }
} }
} else { } else {

View file

@ -339,6 +339,7 @@ public class XwJNI {
// Keep in sync with server.h // Keep in sync with server.h
public enum RematchOrder { public enum RematchOrder {
RO_NONE(0),
RO_SAME(R.string.ro_same), RO_SAME(R.string.ro_same),
RO_LOW_SCORE_FIRST(R.string.ro_low_score_first), RO_LOW_SCORE_FIRST(R.string.ro_low_score_first),
RO_HIGH_SCORE_FIRST(R.string.ro_high_score_first), RO_HIGH_SCORE_FIRST(R.string.ro_high_score_first),

View file

@ -2476,6 +2476,7 @@ RO2Str( RematchOrder ro )
{ {
const char* str = (char*)NULL; const char* str = (char*)NULL;
switch( ro ) { switch( ro ) {
caseStr(RO_NONE);
caseStr(RO_SAME); caseStr(RO_SAME);
caseStr(RO_LOW_SCORE_FIRST); caseStr(RO_LOW_SCORE_FIRST);
caseStr(RO_HIGH_SCORE_FIRST); caseStr(RO_HIGH_SCORE_FIRST);
@ -4415,10 +4416,6 @@ server_getRematchInfo( const ServerCtxt* server, XW_UtilCtxt* newUtil,
} }
LOG_RETURNF( "%s", boolToStr(success) ); LOG_RETURNF( "%s", boolToStr(success) );
/* Until I'm testing edge cases, this will fail because I did something
* wrong, and I need to know that immediately.
*/
XP_ASSERT( success );
return success; return success;
} /* server_getRematchInfo */ } /* server_getRematchInfo */
@ -4463,6 +4460,7 @@ server_figureOrder( const ServerCtxt* server, RematchOrder ro, NewOrder* nop )
void (*proc)(const ServerCtxt*, NewOrder*) = NULL; void (*proc)(const ServerCtxt*, NewOrder*) = NULL;
switch ( ro ) { switch ( ro ) {
case RO_NONE:
case RO_SAME: case RO_SAME:
proc = sortBySame; proc = sortBySame;
break; break;

View file

@ -145,6 +145,7 @@ XP_Bool server_getIsHost( const ServerCtxt* server );
#endif #endif
typedef enum { typedef enum {
RO_NONE,
RO_SAME, /* preserve the parent game's order */ RO_SAME, /* preserve the parent game's order */
RO_LOW_SCORE_FIRST, /* lowest scorer in parent goes first, etc */ RO_LOW_SCORE_FIRST, /* lowest scorer in parent goes first, etc */
RO_HIGH_SCORE_FIRST, /* highest scorer in parent goes first, etc */ RO_HIGH_SCORE_FIRST, /* highest scorer in parent goes first, etc */

View file

@ -132,8 +132,10 @@ cursesask( WINDOW* parentWin, const char* question, short numButtons,
void void
ca_inform( WINDOW* window, const char* message ) ca_inform( WINDOW* window, const char* message )
{ {
const char* buttons[] = { "Ok" }; if ( !!window ) {
(void)cursesask( window, message, VSIZE(buttons), buttons ); const char* buttons[] = { "Ok" };
(void)cursesask( window, message, VSIZE(buttons), buttons );
}
} }
void void

View file

@ -1089,8 +1089,9 @@ curses_util_notifyGameOver( XW_UtilCtxt* uc, XWEnv xwe, XP_S16 quitter )
} }
if ( params->rematchOnDone ) { if ( params->rematchOnDone ) {
XP_ASSERT( !!params->rematchOrder ); RematchOrder ro = !!params->rematchOrder
rematch_and_save_once( bGlobals, roFromStr(params->rematchOrder) ); ? roFromStr(params->rematchOrder) : RO_NONE;
rematch_and_save_once( bGlobals, ro );
} }
} /* curses_util_notifyGameOver */ } /* curses_util_notifyGameOver */