lilijreey / bwapi

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

getType().maxHitPoints() value is incorrect for atleast terran buildings #148

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
Fixed with r1636 and r1666.

Original comment by lowerlo...@gmail.com on 29 Nov 2009 at 5:32