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

Method execute

bwapi/BWScriptEmulator/If_Owned.cpp:9–25  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7If_Owned enemyowns_jump_impl(AISCRIPT::Enum::ENEMYOWNS_JUMP);
8
9bool If_Owned::execute(aithread &thread) const
10{
11 // Parameters
12 WORD wUnitType, wJump;
13 thread.readTuple( std::tie(wUnitType, wJump) );
14
15 // Get Player's units depending on opcode
16 Unitset units( this->getOpcode() == Enum::IF_OWNED ? Broodwar->self()->getUnits() : Broodwar->enemies().getUnits() );
17
18 // Check if the player owns at least one of the given unit type
19 if ( std::find_if(units.begin(), units.end(), GetType == wUnitType) != units.end() )
20 thread.setScriptOffset( wJump );
21
22 // Debug and return
23 thread.saveDebug(Text::Green, this->getOpcode(), "%s p_%04X", AISCRIPT::getUnitName(wUnitType), wJump );
24 return true;
25}

Callers

nothing calls this directly

Calls 9

getUnitNameFunction · 0.85
getOpcodeMethod · 0.80
beginMethod · 0.80
endMethod · 0.80
setScriptOffsetMethod · 0.80
saveDebugMethod · 0.80
readTupleMethod · 0.45
getUnitsMethod · 0.45
selfMethod · 0.45

Tested by

no test coverage detected