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];
for ( RematchOrder ro : RematchOrder.values() ) {
RadioButton button = new RadioButton( mContext );
button.setText( LocUtils.getString( mContext, ro.getStrID() ) );
mGroup.addView( button );
mRos.put( button.getId(), ro );
if ( lastSel == ro ) {
button.setChecked( true );
int strId = ro.getStrID();
if ( 0 != strId ) {
RadioButton button = new RadioButton( mContext );
button.setText( LocUtils.getString( mContext, strId ) );
mGroup.addView( button );
mRos.put( button.getId(), ro );
if ( lastSel == ro ) {
button.setChecked( true );
}
}
}
} else {

View file

@ -339,6 +339,7 @@ public class XwJNI {
// Keep in sync with server.h
public enum RematchOrder {
RO_NONE(0),
RO_SAME(R.string.ro_same),
RO_LOW_SCORE_FIRST(R.string.ro_low_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;
switch( ro ) {
caseStr(RO_NONE);
caseStr(RO_SAME);
caseStr(RO_LOW_SCORE_FIRST);
caseStr(RO_HIGH_SCORE_FIRST);
@ -4415,10 +4416,6 @@ server_getRematchInfo( const ServerCtxt* server, XW_UtilCtxt* newUtil,
}
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;
} /* server_getRematchInfo */
@ -4463,6 +4460,7 @@ server_figureOrder( const ServerCtxt* server, RematchOrder ro, NewOrder* nop )
void (*proc)(const ServerCtxt*, NewOrder*) = NULL;
switch ( ro ) {
case RO_NONE:
case RO_SAME:
proc = sortBySame;
break;

View file

@ -145,6 +145,7 @@ XP_Bool server_getIsHost( const ServerCtxt* server );
#endif
typedef enum {
RO_NONE,
RO_SAME, /* preserve the parent game's order */
RO_LOW_SCORE_FIRST, /* lowest 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
ca_inform( WINDOW* window, const char* message )
{
const char* buttons[] = { "Ok" };
(void)cursesask( window, message, VSIZE(buttons), buttons );
if ( !!window ) {
const char* buttons[] = { "Ok" };
(void)cursesask( window, message, VSIZE(buttons), buttons );
}
}
void

View file

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