mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-15 15:41:24 +01:00
make util_userQuery return bool
This commit is contained in:
parent
f76f18e3ca
commit
354bd96db4
4 changed files with 17 additions and 13 deletions
|
@ -89,8 +89,8 @@ typedef struct UtilVtable {
|
||||||
XP_U16 col, XP_U16 row );
|
XP_U16 col, XP_U16 row );
|
||||||
void (*m_util_userError)( XW_UtilCtxt* uc, UtilErrID id );
|
void (*m_util_userError)( XW_UtilCtxt* uc, UtilErrID id );
|
||||||
|
|
||||||
XP_U16 (*m_util_userQuery)( XW_UtilCtxt* uc, UtilQueryID id,
|
XP_Bool (*m_util_userQuery)( XW_UtilCtxt* uc, UtilQueryID id,
|
||||||
XWStreamCtxt* stream );
|
XWStreamCtxt* stream );
|
||||||
|
|
||||||
/* return of < 0 means computer should pick */
|
/* return of < 0 means computer should pick */
|
||||||
XP_S16 (*m_util_userPickTile)( XW_UtilCtxt* uc, PickInfo* pi,
|
XP_S16 (*m_util_userPickTile)( XW_UtilCtxt* uc, PickInfo* pi,
|
||||||
|
|
|
@ -118,7 +118,7 @@ curses_util_userError( XW_UtilCtxt* uc, UtilErrID id )
|
||||||
cursesUserError( globals, message );
|
cursesUserError( globals, message );
|
||||||
} /* curses_util_userError */
|
} /* curses_util_userError */
|
||||||
|
|
||||||
static XP_U16
|
static XP_Bool
|
||||||
curses_util_userQuery( XW_UtilCtxt* uc, UtilQueryID id, XWStreamCtxt* stream )
|
curses_util_userQuery( XW_UtilCtxt* uc, UtilQueryID id, XWStreamCtxt* stream )
|
||||||
{
|
{
|
||||||
CursesAppGlobals* globals;
|
CursesAppGlobals* globals;
|
||||||
|
@ -126,7 +126,8 @@ curses_util_userQuery( XW_UtilCtxt* uc, UtilQueryID id, XWStreamCtxt* stream )
|
||||||
char* answers[3];
|
char* answers[3];
|
||||||
short numAnswers = 0;
|
short numAnswers = 0;
|
||||||
XP_Bool freeMe = XP_FALSE;
|
XP_Bool freeMe = XP_FALSE;
|
||||||
XP_U16 result;
|
XP_Bool result;
|
||||||
|
XP_U16 okIndex = 1;
|
||||||
|
|
||||||
switch( id ) {
|
switch( id ) {
|
||||||
case QUERY_COMMIT_TURN:
|
case QUERY_COMMIT_TURN:
|
||||||
|
@ -145,6 +146,7 @@ curses_util_userQuery( XW_UtilCtxt* uc, UtilQueryID id, XWStreamCtxt* stream )
|
||||||
question = strFromStream( stream );
|
question = strFromStream( stream );
|
||||||
freeMe = XP_TRUE;
|
freeMe = XP_TRUE;
|
||||||
answers[numAnswers++] = "Ok";
|
answers[numAnswers++] = "Ok";
|
||||||
|
okIndex = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -153,7 +155,7 @@ curses_util_userQuery( XW_UtilCtxt* uc, UtilQueryID id, XWStreamCtxt* stream )
|
||||||
}
|
}
|
||||||
globals = (CursesAppGlobals*)uc->closure;
|
globals = (CursesAppGlobals*)uc->closure;
|
||||||
result = cursesask( globals, question, numAnswers,
|
result = cursesask( globals, question, numAnswers,
|
||||||
answers[0], answers[1], answers[2] );
|
answers[0], answers[1], answers[2] ) == okIndex;
|
||||||
|
|
||||||
if ( freeMe ) {
|
if ( freeMe ) {
|
||||||
free( question );
|
free( question );
|
||||||
|
|
|
@ -1141,14 +1141,15 @@ gtk_util_userError( XW_UtilCtxt* uc, UtilErrID id )
|
||||||
gtkUserError( globals, message );
|
gtkUserError( globals, message );
|
||||||
} /* gtk_util_userError */
|
} /* gtk_util_userError */
|
||||||
|
|
||||||
static XP_U16
|
static XP_Bool
|
||||||
gtk_util_userQuery( XW_UtilCtxt* uc, UtilQueryID id, XWStreamCtxt* stream )
|
gtk_util_userQuery( XW_UtilCtxt* uc, UtilQueryID id, XWStreamCtxt* stream )
|
||||||
{
|
{
|
||||||
XP_U16 result;
|
XP_Bool result;
|
||||||
GtkAppGlobals* globals = (GtkAppGlobals*)uc->closure;
|
GtkAppGlobals* globals = (GtkAppGlobals*)uc->closure;
|
||||||
char* question;
|
char* question;
|
||||||
char* answers[3];
|
char* answers[3];
|
||||||
gint numAnswers = 0;
|
gint numAnswers = 0;
|
||||||
|
XP_U16 okIndex = 1;
|
||||||
XP_Bool freeMe = XP_FALSE;
|
XP_Bool freeMe = XP_FALSE;
|
||||||
|
|
||||||
switch( id ) {
|
switch( id ) {
|
||||||
|
@ -1173,15 +1174,16 @@ gtk_util_userQuery( XW_UtilCtxt* uc, UtilQueryID id, XWStreamCtxt* stream )
|
||||||
question = strFromStream( stream );
|
question = strFromStream( stream );
|
||||||
freeMe = XP_TRUE;
|
freeMe = XP_TRUE;
|
||||||
answers[numAnswers++] = "Ok";
|
answers[numAnswers++] = "Ok";
|
||||||
|
okIndex = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
XP_ASSERT( 0 );
|
XP_ASSERT( 0 );
|
||||||
return 0;
|
return XP_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = gtkask( globals, question, numAnswers,
|
result = gtkask( globals, question, numAnswers,
|
||||||
answers[0], answers[1], answers[2] );
|
answers[0], answers[1], answers[2] ) == okIndex;
|
||||||
|
|
||||||
if ( freeMe > 0 ) {
|
if ( freeMe > 0 ) {
|
||||||
free( question );
|
free( question );
|
||||||
|
|
|
@ -119,8 +119,8 @@ static Boolean handleHintRequest( PalmAppGlobals* globals );
|
||||||
/* callbacks */
|
/* callbacks */
|
||||||
static VTableMgr* palm_util_getVTManager( XW_UtilCtxt* uc );
|
static VTableMgr* palm_util_getVTManager( XW_UtilCtxt* uc );
|
||||||
static void palm_util_userError( XW_UtilCtxt* uc, UtilErrID id );
|
static void palm_util_userError( XW_UtilCtxt* uc, UtilErrID id );
|
||||||
static XP_U16 palm_util_userQuery( XW_UtilCtxt* uc, UtilQueryID id,
|
static XP_Bool palm_util_userQuery( XW_UtilCtxt* uc, UtilQueryID id,
|
||||||
XWStreamCtxt* stream );
|
XWStreamCtxt* stream );
|
||||||
static XWBonusType palm_util_getSquareBonus( XW_UtilCtxt* uc,
|
static XWBonusType palm_util_getSquareBonus( XW_UtilCtxt* uc,
|
||||||
ModelCtxt* model,
|
ModelCtxt* model,
|
||||||
XP_U16 col, XP_U16 row );
|
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, " ", " " );
|
(void)FrmCustomAlert( XW_ERROR_ALERT_ID, (const char*)message, " ", " " );
|
||||||
} /* userErrorFromStrId */
|
} /* userErrorFromStrId */
|
||||||
|
|
||||||
static XP_U16
|
static XP_Bool
|
||||||
palm_util_userQuery( XW_UtilCtxt* uc, UtilQueryID id, XWStreamCtxt* stream )
|
palm_util_userQuery( XW_UtilCtxt* uc, UtilQueryID id, XWStreamCtxt* stream )
|
||||||
{
|
{
|
||||||
PalmAppGlobals* globals = (PalmAppGlobals*)uc->closure;
|
PalmAppGlobals* globals = (PalmAppGlobals*)uc->closure;
|
||||||
|
@ -2886,7 +2886,7 @@ palm_util_userQuery( XW_UtilCtxt* uc, UtilQueryID id, XWStreamCtxt* stream )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return palmaskFromStrId( globals, strID, -1, -1 );
|
return (XP_Bool)palmaskFromStrId( globals, strID, -1, -1 );
|
||||||
} /* palm_util_userQuery */
|
} /* palm_util_userQuery */
|
||||||
|
|
||||||
static XWBonusType
|
static XWBonusType
|
||||||
|
|
Loading…
Reference in a new issue