MCPcopy Create free account
hub / github.com/Blizzard/s2client-api / GetRandomUnit

Method GetRandomUnit

examples/common/bot_examples.cc:196–203  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

194}
195
196bool MultiplayerBot::GetRandomUnit(Unit& unit_out, const ObservationInterface* observation, UnitTypeID unit_type) {
197 Units my_units = observation->GetUnits(Unit::Alliance::Self, IsUnit(unit_type));
198 if (!my_units.empty()) {
199 unit_out = GetRandomEntry(my_units);
200 return true;
201 }
202 return false;
203}
204
205bool MultiplayerBot::FindNearestMineralPatch(const Point2D& start, Tag& target) {
206 Units units = Observation()->GetUnits(Unit::Alliance::Neutral);

Callers

nothing calls this directly

Calls 2

IsUnitClass · 0.85
GetUnitsMethod · 0.80

Tested by

no test coverage detected