Skip to content
Snippets Groups Projects
Commit 7a75dd33 authored by Sopi (sofab194)'s avatar Sopi (sofab194)
Browse files

cleaned code, replaced comments

parent deea9dde
Branches
No related tags found
No related merge requests found
...@@ -301,19 +301,18 @@ bool Unit::isConstructing(const UnitType & type) const ...@@ -301,19 +301,18 @@ bool Unit::isConstructing(const UnitType & type) const
Unit Unit::getTarget() const Unit Unit::getTarget() const
{ {
BOT_ASSERT(isValid(), "Unit is not valid"); BOT_ASSERT(isValid(), "Unit is not valid");
BOT_ASSERT(hasTarget(), "Unit has no target"); BOT_ASSERT(hasTarget(), "Unit has no target");
//if unit has order, check tag of target of first order //if unit has order, check tag of target of first order
if(getUnitPtr()->orders.size() > 0){ if(getUnitPtr()->orders.size() > 0){
//pray that this value can be declared as CCUnitID //t_id is set to the unit tag of the target
CCUnitID t_id = getUnitPtr()->orders[0].target_unit_tag; CCUnitID t_id = getUnitPtr()->orders[0].target_unit_tag;
//let IDAbot find the unit with this tag //IDAbot finds the unit with this tag
return m_bot->GetUnit(t_id); return m_bot->GetUnit(t_id);
} }
//Unit* empty_unit = new Unit();
Unit this_unit = Unit(m_unit, *m_bot); Unit this_unit = Unit(m_unit, *m_bot);
return this_unit; return this_unit;
} }
bool Unit::hasTarget() const bool Unit::hasTarget() const
...@@ -323,7 +322,7 @@ bool Unit::hasTarget() const ...@@ -323,7 +322,7 @@ bool Unit::hasTarget() const
if (getUnitPtr()->orders.size() > 0) { if (getUnitPtr()->orders.size() > 0) {
if (getUnitPtr()->orders[0].target_unit_tag != NULL) { if (getUnitPtr()->orders[0].target_unit_tag != NULL) {
CCUnitID t_id = getUnitPtr()->orders[0].target_unit_tag; CCUnitID t_id = getUnitPtr()->orders[0].target_unit_tag;
//let IDAbot find the unit with this tag //IDAbot finds the unit with this tag, and returns true if valid
return m_bot->GetUnit(t_id).isValid(); return m_bot->GetUnit(t_id).isValid();
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment