| 564 | |
| 565 | |
| 566 | auto convert_pbn(char * dealBuff, |
| 567 | unsigned int remainCards[DDS_HANDS][DDS_SUITS]) -> int |
| 568 | { |
| 569 | int buffer_pos = 0, first_hand, card, hand, hand_rel_first, suit_in_hand, h, s; |
| 570 | |
| 571 | for (h = 0; h < DDS_HANDS; h++) |
| 572 | for (s = 0; s < DDS_SUITS; s++) |
| 573 | remainCards[h][s] = 0; |
| 574 | |
| 575 | while (((dealBuff[buffer_pos] != 'W') && (dealBuff[buffer_pos] != 'N') && |
| 576 | (dealBuff[buffer_pos] != 'E') && (dealBuff[buffer_pos] != 'S') && |
| 577 | (dealBuff[buffer_pos] != 'w') && (dealBuff[buffer_pos] != 'n') && |
| 578 | (dealBuff[buffer_pos] != 'e') && (dealBuff[buffer_pos] != 's')) && (buffer_pos < 3)) |
| 579 | buffer_pos++; |
| 580 | |
| 581 | if (buffer_pos >= 3) |
| 582 | return 0; |
| 583 | |
| 584 | if ((dealBuff[buffer_pos] == 'N') || (dealBuff[buffer_pos] == 'n')) |
| 585 | first_hand = 0; |
| 586 | else if ((dealBuff[buffer_pos] == 'E') || (dealBuff[buffer_pos] == 'e')) |
| 587 | first_hand = 1; |
| 588 | else if ((dealBuff[buffer_pos] == 'S') || (dealBuff[buffer_pos] == 's')) |
| 589 | first_hand = 2; |
| 590 | else |
| 591 | first_hand = 3; |
| 592 | |
| 593 | buffer_pos++; |
| 594 | buffer_pos++; |
| 595 | |
| 596 | hand_rel_first = 0; |
| 597 | suit_in_hand = 0; |
| 598 | |
| 599 | while ((buffer_pos < 80) && (dealBuff[buffer_pos] != '\0')) |
| 600 | { |
| 601 | card = is_a_card(dealBuff[buffer_pos]); |
| 602 | if (card) |
| 603 | { |
| 604 | switch (first_hand) |
| 605 | { |
| 606 | case 0: |
| 607 | hand = hand_rel_first; |
| 608 | break; |
| 609 | case 1: |
| 610 | if (hand_rel_first == 0) |
| 611 | hand = 1; |
| 612 | else if (hand_rel_first == 3) |
| 613 | hand = 0; |
| 614 | else |
| 615 | hand = hand_rel_first + 1; |
| 616 | break; |
| 617 | case 2: |
| 618 | if (hand_rel_first == 0) |
| 619 | hand = 2; |
| 620 | else if (hand_rel_first == 1) |
| 621 | hand = 3; |
| 622 | else |
| 623 | hand = hand_rel_first - 2; |
no test coverage detected