make util_userQuery return bool

This commit is contained in:
ehouse 2004-02-17 04:00:12 +00:00
parent f76f18e3ca
commit 354bd96db4
4 changed files with 17 additions and 13 deletions

View file

@ -89,8 +89,8 @@ typedef struct UtilVtable {
XP_U16 col, XP_U16 row );
void (*m_util_userError)( XW_UtilCtxt* uc, UtilErrID id );
XP_U16 (*m_util_userQuery)( XW_UtilCtxt* uc, UtilQueryID id,
XWStreamCtxt* stream );
XP_Bool (*m_util_userQuery)( XW_UtilCtxt* uc, UtilQueryID id,
XWStreamCtxt* stream );
/* return of < 0 means computer should pick */
XP_S16 (*m_util_userPickTile)( XW_UtilCtxt* uc, PickInfo* pi,

View file

@ -118,7 +118,7 @@ curses_util_userError( XW_UtilCtxt* uc, UtilErrID id )
cursesUserError( globals, message );
} /* curses_util_userError */
static XP_U16
static XP_Bool
curses_util_userQuery( XW_UtilCtxt* uc, UtilQueryID id, XWStreamCtxt* stream )
{
CursesAppGlobals* globals;
@ -126,7 +126,8 @@ curses_util_userQuery( XW_UtilCtxt* uc, UtilQueryID id, XWStreamCtxt* stream )
char* answers[3];
short numAnswers = 0;
XP_Bool freeMe = XP_FALSE;
XP_U16 result;
XP_Bool result;
XP_U16 okIndex = 1;
switch( id ) {
case QUERY_COMMIT_TURN:
@ -145,6 +146,7 @@ curses_util_userQuery( XW_UtilCtxt* uc, UtilQueryID id, XWStreamCtxt* stream )
question = strFromStream( stream );
freeMe = XP_TRUE;
answers[numAnswers++] = "Ok";
okIndex = 0;
break;
default:
@ -153,7 +155,7 @@ curses_util_userQuery( XW_UtilCtxt* uc, UtilQueryID id, XWStreamCtxt* stream )
}
globals = (CursesAppGlobals*)uc->closure;
result = cursesask( globals, question, numAnswers,
answers[0], answers[1], answers[2] );
answers[0], answers[1], answers[2] ) == okIndex;
if ( freeMe ) {
free( question );

View file

@ -1141,14 +1141,15 @@ gtk_util_userError( XW_UtilCtxt* uc, UtilErrID id )
gtkUserError( globals, message );
} /* gtk_util_userError */
static XP_U16
static XP_Bool
gtk_util_userQuery( XW_UtilCtxt* uc, UtilQueryID id, XWStreamCtxt* stream )
{
XP_U16 result;
XP_Bool result;
GtkAppGlobals* globals = (GtkAppGlobals*)uc->closure;
char* question;
char* answers[3];
gint numAnswers = 0;
XP_U16 okIndex = 1;
XP_Bool freeMe = XP_FALSE;
switch( id ) {
@ -1173,15 +1174,16 @@ gtk_util_userQuery( XW_UtilCtxt* uc, UtilQueryID id, XWStreamCtxt* stream )
question = strFromStream( stream );
freeMe = XP_TRUE;
answers[numAnswers++] = "Ok";
okIndex = 0;
break;
default:
XP_ASSERT( 0 );
return 0;
return XP_FALSE;
}
result = gtkask( globals, question, numAnswers,
answers[0], answers[1], answers[2] );
answers[0], answers[1], answers[2] ) == okIndex;
if ( freeMe > 0 ) {
free( question );

View file

@ -119,8 +119,8 @@ static Boolean handleHintRequest( PalmAppGlobals* globals );
/* callbacks */
static VTableMgr* palm_util_getVTManager( XW_UtilCtxt* uc );
static void palm_util_userError( XW_UtilCtxt* uc, UtilErrID id );
static XP_U16 palm_util_userQuery( XW_UtilCtxt* uc, UtilQueryID id,
XWStreamCtxt* stream );
static XP_Bool palm_util_userQuery( XW_UtilCtxt* uc, UtilQueryID id,
XWStreamCtxt* stream );
static XWBonusType palm_util_getSquareBonus( XW_UtilCtxt* uc,
ModelCtxt* model,
XP_U16 col, XP_U16 row );
@ -2864,7 +2864,7 @@ userErrorFromStrId( PalmAppGlobals* globals, XP_U16 strID )
(void)FrmCustomAlert( XW_ERROR_ALERT_ID, (const char*)message, " ", " " );
} /* userErrorFromStrId */
static XP_U16
static XP_Bool
palm_util_userQuery( XW_UtilCtxt* uc, UtilQueryID id, XWStreamCtxt* stream )
{
PalmAppGlobals* globals = (PalmAppGlobals*)uc->closure;
@ -2886,7 +2886,7 @@ palm_util_userQuery( XW_UtilCtxt* uc, UtilQueryID id, XWStreamCtxt* stream )
break;
}
return palmaskFromStrId( globals, strID, -1, -1 );
return (XP_Bool)palmaskFromStrId( globals, strID, -1, -1 );
} /* palm_util_userQuery */
static XWBonusType