What steps will reproduce the problem?
1. Loop through all your units
2. evaluate with:
if((*i)->getType().isBuilding() && (*i)->isCompleted() && (*i)->getHitPoints()
< (*i)->getType().maxHitPoints())
3. Print a message saying that the unit needs repairing
4. Play as terran and attack one of your own completed buildings
What is the expected output? What do you see instead?
It should evaluate true as soon as its health drops below full health and spam
the chat. Instead it evaluates true when
the units health gets to around 1/4 full
What version of the product are you using? On what operating system?
Beta 2.3.1
Please provide any additional information below.
The code for easy running:
std::set<BWAPI::Unit *> units = BWAPI::Broodwar->self()->getUnits();
for(std::set<BWAPI::Unit*>::iterator i = units.begin(); i != units.end(); i++)
{
if((*i)->getType().isBuilding() && (*i)->isCompleted() && (*i)->getHitPoints() < (*i)->getType().maxHitPoints())
{
Broodwar->sendText("Building needs Repairing");
}
}
Original issue reported on code.google.com by quaver.smith on 29 Nov 2009 at 12:31
Original issue reported on code.google.com by
quaver.smith
on 29 Nov 2009 at 12:31