From 354bd96db4c51f36cb09d7b84d97f6991077de1a Mon Sep 17 00:00:00 2001 From: ehouse Date: Tue, 17 Feb 2004 04:00:12 +0000 Subject: [PATCH] make util_userQuery return bool --- common/util.h | 4 ++-- linux/cursesmain.c | 8 +++++--- linux/gtkmain.c | 10 ++++++---- palm/palmmain.c | 8 ++++---- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/common/util.h b/common/util.h index 16dee7063..5ff31ae2a 100644 --- a/common/util.h +++ b/common/util.h @@ -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, diff --git a/linux/cursesmain.c b/linux/cursesmain.c index 4ee9293b1..a7a4b0793 100644 --- a/linux/cursesmain.c +++ b/linux/cursesmain.c @@ -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 ); diff --git a/linux/gtkmain.c b/linux/gtkmain.c index d07512ed6..7c18f3ec5 100644 --- a/linux/gtkmain.c +++ b/linux/gtkmain.c @@ -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 ); diff --git a/palm/palmmain.c b/palm/palmmain.c index e417e1135..760e3ac00 100644 --- a/palm/palmmain.c +++ b/palm/palmmain.c @@ -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