canAccess returns true if the AI module is allowed to access the unit. If the unit is visible, returns true. If the unit is does not exist, returns false. If the unit is not visible and exists, returns true only if CompleteMapInformation is enabled. */
| 170 | If the unit is not visible and exists, returns true only if CompleteMapInformation is enabled. |
| 171 | */ |
| 172 | bool UnitImpl::canAccess() const |
| 173 | { |
| 174 | if (!this->isAlive) |
| 175 | return false; |
| 176 | if (this->isVisible()) |
| 177 | return true; |
| 178 | |
| 179 | //if we get here, the unit exists but is not visible |
| 180 | if ( BroodwarImpl.isFlagEnabled(Flag::CompleteMapInformation) ) |
| 181 | return true; |
| 182 | |
| 183 | // neutral units visible during AIModule::onStart |
| 184 | if ( Broodwar->getFrameCount() == 0 ) |
| 185 | if (this->_getType.isNeutral() || (this->_getPlayer && this->_getPlayer->isNeutral()) ) |
| 186 | return true; |
| 187 | return false; |
| 188 | } |
| 189 | bool UnitImpl::canAccessDetected() const |
| 190 | { |
| 191 | if (!canAccess()) |
no test coverage detected