| 6 | IMPLEMENT(Groundmap_Jump); |
| 7 | |
| 8 | bool Groundmap_Jump::execute(aithread &thread) const |
| 9 | { |
| 10 | // Retrieve parameters |
| 11 | WORD wOffset; |
| 12 | thread.readTuple( std::tie(wOffset) ); |
| 13 | |
| 14 | // Get all enemy structures |
| 15 | Unitset enemyUnits( Broodwar->enemies().getUnits() ); |
| 16 | enemyUnits.erase_if( !(Exists && IsBuilding && !IsLifted) ); |
| 17 | |
| 18 | // Check if there is a path to at least one enemy structure, then jump |
| 19 | for ( auto u : enemyUnits ) |
| 20 | { |
| 21 | if ( u->hasPath(thread.getLocation().center()) ) |
| 22 | { |
| 23 | thread.setScriptOffset( wOffset ); |
| 24 | break; |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | // Save debug info and return |
| 29 | thread.saveDebug(Text::Green, this->getOpcode(), "p_%04X", wOffset); |
| 30 | return true; |
| 31 | } |
nothing calls this directly
no test coverage detected