lilijreey / bwapi

Automatically exported from code.google.com/p/bwapi
0 stars 0 forks source link

getUnitsInWeaponRange not working properly #452

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Using BWAPI 3.7.4 (r4160).

When I try to get the units in weapon (Arclite Shock Cannon) range the output 
is always 0.

unit->getUnitsInWeaponRange(WeaponTypes::Arclite_Shock_Cannon);

But getUnitsInRadius() is working properly.

unit->getUnitsInRadius(384); // 384 is the max range of Arclite_Shock_Cannon

Original issue reported on code.google.com by warwol...@gmail.com on 12 Aug 2012 at 8:14

GoogleCodeExporter commented 9 years ago
In the BWAPI4 the following test succeeded:

      auto myUnits = unit->getUnitsInWeaponRange(WeaponTypes::Arclite_Shock_Cannon);
      TEST(Assert, std::find_if(myUnits.begin(), myUnits.end(), Filter::GetType != UnitTypes::Terran_Civilian) != myUnits.end() || myUnits.size() != 3 );

It gets the units in the shock cannon's weapon range and first checks if there 
is anything other than a civilian in the set, and that there are 3 of them. 2 
non-civilians were placed on the map too close and too far to be in range, 
indicating the correct behaviour.

It appears to have been fixed while developing BWAPI4.

Original comment by AHeinerm on 24 Mar 2013 at 2:52