----------------------------------------------- IS VISIBLE -----------------------------------------------
| 65 | } |
| 66 | //----------------------------------------------- IS VISIBLE ----------------------------------------------- |
| 67 | bool BulletImpl::isVisible(BWAPI::Player player) const |
| 68 | { |
| 69 | if ( player == nullptr ) // Default to self |
| 70 | player = Broodwar->self(); |
| 71 | |
| 72 | if ( player != nullptr ) // Only if player is valid |
| 73 | { |
| 74 | int id = player->getID(); |
| 75 | if ( id >= 0 && id < 9 ) // Check if ID is valid |
| 76 | return self->isVisible[id]; // return visibility |
| 77 | } |
| 78 | else // fallback for self also being null |
| 79 | { |
| 80 | for(int i = 0; i < 9; ++i) // check if the bullet is visible by ANY player |
| 81 | { |
| 82 | if ( self->isVisible[i] ) |
| 83 | return true; |
| 84 | } |
| 85 | } |
| 86 | return false; |
| 87 | } |
| 88 | } |
| 89 |