| 7 | If_Owned enemyowns_jump_impl(AISCRIPT::Enum::ENEMYOWNS_JUMP); |
| 8 | |
| 9 | bool 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 | } |
nothing calls this directly
no test coverage detected