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

Method execute

bwapi/BWScriptEmulator/Player_Ally.cpp:9–23  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7Player_Ally player_enemy_impl(AISCRIPT::Enum::PLAYER_ENEMY);
8
9bool Player_Ally::execute(aithread &thread) const
10{
11 // @TODO: BWAPI: Unitset::getPlayers for retrieving set of players owning the units, not important
12 /* can become
13 unitsInRect( bw->getUnitsInRectangle(location.topLeft, location.bottomRight, GetPlayer != self) ).getPlayers().setAlliance(bOpcode == AISCRIPT::Enum::PLAYER_ALLY);
14 */
15 // Set the alliance of all players who own units inside the thread's execution location
16 Unitset units( Broodwar->getUnitsInRectangle(thread.getLocation().topLeft, thread.getLocation().bottomRight, GetPlayer != Broodwar->self()) );
17 for ( auto u : units)
18 Broodwar->setAlliance(u->getPlayer(), this->getOpcode() == AISCRIPT::Enum::PLAYER_ALLY);
19
20 // Debug and return
21 thread.saveDebug(Text::Green, this->getOpcode());
22 return true;
23}

Callers

nothing calls this directly

Calls 7

getLocationMethod · 0.80
getOpcodeMethod · 0.80
saveDebugMethod · 0.80
getUnitsInRectangleMethod · 0.45
selfMethod · 0.45
setAllianceMethod · 0.45
getPlayerMethod · 0.45

Tested by

no test coverage detected