MCPcopy Create free account
hub / github.com/bwapi/bwapi / canAccess

Method canAccess

bwapi/BWAPI/Source/BWAPI/UnitImpl.cpp:172–188  ·  view source on GitHub ↗

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. */

Source from the content-addressed store, hash-verified

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())

Callers 3

indexToUnitMethod · 0.80
updateSharedMemoryMethod · 0.80

Calls 4

isVisibleMethod · 0.95
isFlagEnabledMethod · 0.45
getFrameCountMethod · 0.45
isNeutralMethod · 0.45

Tested by

no test coverage detected