Allow deletion of picked tiles during face-up picking.

This commit is contained in:
ehouse 2004-05-14 08:57:38 +00:00
parent bc00a04873
commit b07b947c44
3 changed files with 19 additions and 5 deletions

View file

@ -1376,20 +1376,29 @@ fetchTiles( ServerCtxt* server, XP_U16 playerNum, XP_U16 nToFetch,
model_packTilesUtil( server->vol.model, pool, model_packTilesUtil( server->vol.model, pool,
XP_TRUE, &nUsed, texts, tiles ); XP_TRUE, &nUsed, texts, tiles );
++pi.thisPick;
chosen = util_userPickTile( server->vol.util, &pi, chosen = util_userPickTile( server->vol.util, &pi,
playerNum, texts, nUsed ); playerNum, texts, nUsed );
if ( chosen < 0 ) { if ( chosen == PICKER_PICKALL ) {
ask = XP_FALSE; ask = XP_FALSE;
} else if ( chosen == PICKER_BACKUP ) {
if ( nSoFar > 0 ) {
TrayTileSet tiles;
tiles.nTiles = 1;
tiles.tiles[0] = resultTiles->tiles[--nSoFar];
pool_replaceTiles( server->pool, &tiles );
--pi.nCurTiles;
--pi.thisPick;
}
} else { } else {
Tile tile = tiles[chosen]; Tile tile = tiles[chosen];
oneTile.tiles[0] = tile; oneTile.tiles[0] = tile;
pool_removeTiles( pool, &oneTile ); pool_removeTiles( pool, &oneTile );
(void)dict_tilesToString( dict, &tile, 1, (XP_UCHAR*)&curTray[pi.nCurTiles++] ); (void)dict_tilesToString( dict, &tile, 1,
(XP_UCHAR*)&curTray[pi.nCurTiles++] );
resultTiles->tiles[nSoFar++] = tile; resultTiles->tiles[nSoFar++] = tile;
++pi.thisPick;
} }
} }
#endif #endif

View file

@ -46,9 +46,10 @@ typedef enum {
users */ users */
#endif #endif
ERR_CANT_TRADE_MID_MOVE, ERR_CANT_TRADE_MID_MOVE,
ERR_CANT_ENGINE_MID_MOVE ERR_CANT_ENGINE_MID_MOVE,
/* ERR_NOT_YOUR_TURN_TO_TRADE, */ /* ERR_NOT_YOUR_TURN_TO_TRADE, */
/* ERR_NOT_YOUR_TURN_TO_MOVE, */ /* ERR_NOT_YOUR_TURN_TO_MOVE, */
ERR_CANT_UNDO_TILEASSIGN
} UtilErrID; } UtilErrID;
typedef enum { typedef enum {
@ -63,6 +64,9 @@ typedef enum {
, PICK_FOR_CHEAT , PICK_FOR_CHEAT
} PICK_WHY; } PICK_WHY;
#define PICKER_PICKALL -1
#define PICKER_BACKUP -2
typedef struct PickInfo { typedef struct PickInfo {
XP_UCHAR4* curTiles; XP_UCHAR4* curTiles;
XP_U16 nCurTiles; XP_U16 nCurTiles;

View file

@ -205,6 +205,7 @@
#define XW_BLANK_LABEL_FIELD_ID 2402 #define XW_BLANK_LABEL_FIELD_ID 2402
#define XW_BLANK_OK_BUTTON_ID 2403 #define XW_BLANK_OK_BUTTON_ID 2403
#define XW_BLANK_PICK_BUTTON_ID 2404 #define XW_BLANK_PICK_BUTTON_ID 2404
#define XW_BLANK_BACKUP_BUTTON_ID 2405
#define XW_COLORS_FACTORY_BUTTON_ID 2520 #define XW_COLORS_FACTORY_BUTTON_ID 2520
#define XW_COLORS_OK_BUTTON_ID 2521 #define XW_COLORS_OK_BUTTON_ID 2521