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

Method execute

bwapi/BWScriptEmulator/Groundmap_Jump.cpp:8–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6IMPLEMENT(Groundmap_Jump);
7
8bool 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}

Callers

nothing calls this directly

Calls 9

erase_ifMethod · 0.80
centerMethod · 0.80
getLocationMethod · 0.80
setScriptOffsetMethod · 0.80
saveDebugMethod · 0.80
getOpcodeMethod · 0.80
readTupleMethod · 0.45
getUnitsMethod · 0.45
hasPathMethod · 0.45

Tested by

no test coverage detected