Returns true if the given ship is allowed to be chosen for a pnum
| 3688 | |
| 3689 | // Returns true if the given ship is allowed to be chosen for a pnum |
| 3690 | bool PlayerIsShipAllowed(int pnum, char *ship_name) { |
| 3691 | ASSERT(ship_name); |
| 3692 | |
| 3693 | if (pnum < -1 || pnum >= MAX_PLAYERS) // illegal value |
| 3694 | return false; |
| 3695 | |
| 3696 | int ship_index = FindShipName(ship_name); |
| 3697 | if (ship_index == -1) { |
| 3698 | ASSERT(ship_index != -1); |
| 3699 | return false; |
| 3700 | } |
| 3701 | int bit = 0x01; |
| 3702 | bit = bit << ship_index; |
| 3703 | return ((Players[(pnum != -1) ? pnum : Player_num].ship_permissions & bit) != 0); |
| 3704 | } |
| 3705 | bool PlayerIsShipAllowed(int pnum, int ship_index) { |
| 3706 | if (pnum < -1 || pnum >= MAX_PLAYERS) // illegal value |
| 3707 | return false; |
no test coverage detected