- register int i, j;
- CARD crd;
-
- if( n < 1 ) {
- printf( "\nINFROM: %d = n < 1!!\n", n );
- exit( 74 );
- }
- do {
- if( incard( &crd ) ) { /* if card is full card */
- if( !isone( crd, hand, n ) ) {
- printf( "That's not in your hand. Play one of ( " );
- prhand( hand, n, TRUE );
- printf( " ): " );
- }
- else {
- for( i = 0; i < n; i++ ) {
- if( hand[i].rank == crd.rank &&
- hand[i].suit == crd.suit ) break;
- }
- if( i >= n ) {
- printf( "\nINFROM: isone or something messed up\n" );
- exit( 77 );
- }
- return( i );
- }
- }
- else { /* if not full card... */
- if( crd.rank != -1 ) {
- for( i = 0; i < n; i++ ) {
- if( hand[i].rank == crd.rank ) break;
- }
- if( i >= n ) {
- printf( "No such rank in your hand. Play one of ( " );
- prhand( hand, n, TRUE );
- printf( " ): " );
- }
- else {
- for( j = i + 1; j < n; j++ ) {
- if( hand[j].rank == crd.rank ) break;
- }
- if( j < n ) {
- printf( "Ambiguous rank. Play one of ( " );
- prhand( hand, n, TRUE );
- printf( " ): " );
- }
- else {
- return( i );
- }
- }
- }
- else {
- printf( "Sorry, I missed that. Play one of ( " );
- prhand( hand, n, TRUE );
- printf( " ): " );
- }
- }
- } while( TRUE );
- return( 0 ); /* Useless: keeps lint quiet */
+ register int i, j;
+ CARD crd;
+
+ if (n < 1) {
+ printf("\nINFROM: %d = n < 1!!\n", n);
+ exit(74);
+ }
+ for (;;) {
+ msg(prompt);
+ if (incard(&crd)) { /* if card is full card */
+ if (!isone(crd, hand, n))
+ msg("That's not in your hand");
+ else {
+ for (i = 0; i < n; i++)
+ if (hand[i].rank == crd.rank &&
+ hand[i].suit == crd.suit)
+ break;
+ if (i >= n) {
+ printf("\nINFROM: isone or something messed up\n");
+ exit(77);
+ }
+ return i;
+ }
+ }
+ else /* if not full card... */
+ if (crd.rank != EMPTY) {
+ for (i = 0; i < n; i++)
+ if (hand[i].rank == crd.rank)
+ break;
+ if (i >= n)
+ msg("No such rank in your hand");
+ else {
+ for (j = i + 1; j < n; j++)
+ if (hand[j].rank == crd.rank)
+ break;
+ if (j < n)
+ msg("Ambiguous rank");
+ else
+ return i;
+ }
+ }
+ else
+ msg("Sorry, I missed that");
+ }
+ /* NOTREACHED */