Skip to content
Snippets Groups Projects
Commit 570f99b3 authored by Sopi Abaied's avatar Sopi Abaied :alien:
Browse files

Added isBlip() and getTarget() to Unit

parent 05af0f93
No related branches found
No related tags found
No related merge requests found
......@@ -296,4 +296,29 @@ bool Unit::isConstructing(const UnitType & type) const
{
sc2::AbilityID buildAbility = m_bot->Data(type).buildAbility;
return (getUnitPtr()->orders.size() > 0) && (getUnitPtr()->orders[0].ability_id == buildAbility);
}
\ No newline at end of file
}
Unit Unit::getTarget() const
{
BOT_ASSERT(isValid(), "Unit is not valid");
//if unit has order, check tag of target of first order
if(getUnitPtr()->orders.size() > 0){
//pray that this value can be declared as CCUnitID
CCUnitID t_id = getUnitPtr()->orders[0].target_unit_tag;
//let IDAbot find the unit with this tag
return m_bot->GetUnit(t_id);
}
return;
}
bool Unit::isBlip() const
{
BOT_ASSERT(isValid(), "Unit is not valid");
#ifdef SC2API
return m_unit->is_blip;
#else
return m_unit->isBlip();
#endif
}
......@@ -47,6 +47,9 @@ public:
bool isTraining() const;
bool isConstructing(const UnitType & type) const;
bool isBlip() const;
Unit getTarget() const;
void stop () const;
void attackUnit (const Unit & target) const;
void attackMove (const CCPosition & targetPosition) const;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment