diff --git a/python-api-src/library.cpp b/python-api-src/library.cpp index e14a4c3c7c6f7b5ead20b4c77cc6add217731864..f3af58bbba43347eedf596fed25e35c6a552aead 100644 --- a/python-api-src/library.cpp +++ b/python-api-src/library.cpp @@ -79,7 +79,7 @@ PYBIND11_MODULE(library, m) .def_property_readonly("current_supply", &IDABot::GetCurrentSupply, "How much supply we are currently using") .def_property_readonly("max_supply", &IDABot::GetMaxSupply, "How much supply we can currently use") .def_property_readonly("gas", &IDABot::GetGas, "How much gas we currently have") - .def_property_readonly("current_frame", &IDABot::GetCurrentFrame, "Which frame we are currently on"); + .def_property_readonly("current_frame", &IDABot::GetCurrentFrame, "Which frame we are currently on"); py::class_<sc2::PlayerSetup>(m, "PlayerSetup"); diff --git a/src/Unit.cpp b/src/Unit.cpp index 6dbbbca51aa9e6bef157837ca2b583359842ab8f..4c6290216f33da0068237e394bd28600e114a93e 100644 --- a/src/Unit.cpp +++ b/src/Unit.cpp @@ -300,42 +300,42 @@ bool Unit::isConstructing(const UnitType & type) const Unit Unit::getTarget() const { - BOT_ASSERT(isValid(), "Unit is not valid"); - BOT_ASSERT(hasTarget(), "Unit has no target"); + BOT_ASSERT(isValid(), "Unit is not valid"); + BOT_ASSERT(hasTarget(), "Unit has no target"); - //if unit has order, check tag of target of first order - if(getUnitPtr()->orders.size() > 0){ - //t_id is set to the unit tag of the target - CCUnitID t_id = getUnitPtr()->orders[0].target_unit_tag; - //IDAbot finds the unit with this tag - return m_bot->GetUnit(t_id); - } + //if unit has order, check tag of target of first order + if(getUnitPtr()->orders.size() > 0){ + //t_id is set to the unit tag of the target + CCUnitID t_id = getUnitPtr()->orders[0].target_unit_tag; + //IDAbot finds the unit with this tag + return m_bot->GetUnit(t_id); + } - Unit this_unit = Unit(m_unit, *m_bot); - return this_unit; + Unit this_unit = Unit(m_unit, *m_bot); + return this_unit; } bool Unit::hasTarget() const { - BOT_ASSERT(isValid(), "Unit is not valid"); + BOT_ASSERT(isValid(), "Unit is not valid"); - if (getUnitPtr()->orders.size() > 0) { - if (getUnitPtr()->orders[0].target_unit_tag != NULL) { - CCUnitID t_id = getUnitPtr()->orders[0].target_unit_tag; - //IDAbot finds the unit with this tag, and returns true if valid - return m_bot->GetUnit(t_id).isValid(); - } - } + if (getUnitPtr()->orders.size() > 0) { + if (getUnitPtr()->orders[0].target_unit_tag != NULL) { + CCUnitID t_id = getUnitPtr()->orders[0].target_unit_tag; + //IDAbot finds the unit with this tag, and returns true if valid + return m_bot->GetUnit(t_id).isValid(); + } + } - return false; + return false; } bool Unit::isBlip() const { - BOT_ASSERT(isValid(), "Unit is not valid"); + BOT_ASSERT(isValid(), "Unit is not valid"); #ifdef SC2API - return m_unit->is_blip; + return m_unit->is_blip; #else - return m_unit->isBlip(); + return m_unit->isBlip(); #endif } diff --git a/src/Unit.h b/src/Unit.h index fa5ef836fa77f6ff6e4c740ed6a3a9bdf4f73423..0872d7bfd29a160cafac1280eb81dc3132c7fcf3 100644 --- a/src/Unit.h +++ b/src/Unit.h @@ -48,8 +48,8 @@ public: bool isConstructing(const UnitType & type) const; bool isBlip() const; - bool hasTarget() const; - Unit getTarget() const; + bool hasTarget() const; + Unit getTarget() const; void stop () const; void attackUnit (const Unit & target) const;