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