add util_userError()

This commit is contained in:
ehouse 2010-01-16 18:34:27 +00:00
parent 2d46bd60c9
commit 35943e8731
3 changed files with 47 additions and 3 deletions

View file

@ -55,6 +55,7 @@
<string name="game_config_done">Done</string>
<string name="error_title">Error</string>
<string name="info_title">FYI...</string>
<string name="error_message">Error loading game</string>
<string name="query_title">A question...</string>
<string name="query_trade">Are you sure you want to trade the selected tiles?</string>
@ -119,4 +120,22 @@
<string name="str_bonus_all">Bonus for using all tiles: 50</string>
<string name="strd_turn_score">Score for turn: %d</string>
<!-- error messages -->
<string name="str_tiles_not_in_line">All tiles played must be in a line.</string>
<string name="str_no_empties_in_turn">Empty squares cannot separate tiles played.</string>
<string name="str_two_tiles_first_move">Must play two or more pieces on the first move.</string>
<string name="str_tiles_must_contact">New pieces must contact others already in place (or the middle square on the first move)</string>
<string name="str_not_your_turn">You can't do that; it's not your turn!</string>
<string name="str_no_peek_robot_tiles">No peeking at the robot\'s tiles!</string>
<string name="str_cant_trade_mid_move">Remove played tiles before trading.</string>
<string name="str_too_few_tiles_left_to_trade">Too few tiles left to trade.</string>
<string name="str_cant_undo_tileassign">Tile assignment can't be undone.</string>
<string name="str_cant_hint_while_disabled">The hint feature is disabled for this game. Enable it for a new game using the Preferences dialog.</string>
<string name="str_no_peek_remote_tiles">No peeking at remote players' tiles!</string>
<string name="str_reg_unexpected_user">Refused attempt to register unexpected user[s]</string>
<string name="str_server_dict_wins">Conflict between Host and Guest dictionaries; Host wins.</string>
<string name="str_reg_server_sans_remote">At least one player must be marked \"Remote\" for a game started as Host.</string>
</resources>

View file

@ -1,3 +1,4 @@
/* -*- compile-command: "cd ../../../../../../; ant reinstall"; -*- */
package org.eehouse.android.xw4.jni;
@ -51,6 +52,27 @@ public interface XW_UtilCtxt {
static final int QUERY_ROBOT_TRADE = 3;
boolean userQuery( int id, String query );
// These oughtto be an enum but then I'd have to cons one up in C.
static final int ERR_NONE = 0;
static final int ERR_TILES_NOT_IN_LINE = 1;
static final int ERR_NO_EMPTIES_IN_TURN = 2;
static final int ERR_TWO_TILES_FIRST_MOVE = 3;
static final int ERR_TILES_MUST_CONTACT = 4;
static final int ERR_TOO_FEW_TILES_LEFT_TO_TRADE = 5;
static final int ERR_NOT_YOUR_TURN = 6;
static final int ERR_NO_PEEK_ROBOT_TILES = 7;
static final int ERR_SERVER_DICT_WINS = 8;
static final int ERR_NO_PEEK_REMOTE_TILES = 9;
static final int ERR_REG_UNEXPECTED_USER = 10;
static final int ERR_REG_SERVER_SANS_REMOTE = 11;
static final int STR_NEED_BT_HOST_ADDR = 12;
static final int ERR_CANT_TRADE_MID_MOVE = 13;
static final int ERR_CANT_UNDO_TILEASSIGN = 14;
static final int ERR_CANT_HINT_WHILE_DISABLED = 15;
static final int ERR_RELAY_BASE = 16;
void userError( int id );
// Don't need this unless we have a scroll thumb to indicate position
//void yOffsetChange( int oldOffset, int newOffset );

View file

@ -71,10 +71,10 @@ static XWBonusType and_util_getSquareBonus( XW_UtilCtxt* uc,
static void
and_util_userError( XW_UtilCtxt* uc, UtilErrID id )
{
XP_LOGF( "%s(id=%d)", __func__, id );
UTIL_CBK_HEADER( "userError", "(I)V" );
(*env)->CallVoidMethod( env, util->j_util, mid, id );
}
static XP_Bool
and_util_userQuery( XW_UtilCtxt* uc, UtilQueryID id, XWStreamCtxt* stream )
{
@ -378,7 +378,10 @@ destroyUtil( XW_UtilCtxt* utilc )
int ii;
for ( ii = 0; ii < VSIZE(util->userStrings); ++ii ) {
XP_FREE( util->util.mpool, util->userStrings[ii] );
XP_UCHAR* ptr = util->userStrings[ii];
if ( NULL != ptr ) {
XP_FREE( util->util.mpool, ptr );
}
}
(*env)->DeleteGlobalRef( env, util->j_util );