Skip to content
Snippets Groups Projects
Commit c601ee80 authored by David Bergström's avatar David Bergström
Browse files

Add constructors for UnitType objects

Note the implicit conversion between UNIT_TYPEID and UnitTypeID. This
allows for the creation of UnitType objects directly from UNIT_TYPEID.
parent ed9501d2
No related branches found
No related tags found
No related merge requests found
......@@ -5,6 +5,7 @@ namespace py = pybind11;
void define_unittype(py::module & m)
{
py::class_<UnitType>(m, "UnitType")
.def(py::init<const sc2::UnitTypeID &, IDABot &>())
.def("is", &UnitType::is, "Check if UnitType is UnitTypeID")
.def(py::self == py::self)
.def_property_readonly("name", &UnitType::getName)
......
......@@ -26,6 +26,18 @@ PYBIND11_MODULE(library, m)
.value("Protoss", sc2::Race::Protoss)
.value("Random", sc2::Race::Random);
/*
TODO: These also needs to be defined
typedef SC2Type<ABILITY_ID> AbilityID;
typedef SC2Type<UPGRADE_ID> UpgradeID;
typedef SC2Type<BUFF_ID> BuffID;
*/
py::class_<sc2::UnitTypeID>(m, "UnitTypeID")
.def(py::init<sc2::UNIT_TYPEID>());
py::implicitly_convertible<sc2::UNIT_TYPEID, sc2::UnitTypeID>();
py::class_<sc2::Agent>(m, "Agent")
.def(py::init());
......
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