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

Make units storable in dictionaries and sets in Python

parent d7c4b5d7
No related branches found
No related tags found
No related merge requests found
......@@ -37,5 +37,7 @@ void define_unit(py::module & m)
.def("build_target", &Unit::buildTarget)
.def("train", &Unit::train)
.def("morph", &Unit::morph)
.def("__hash__", [](const Unit & unit) { return std::hash<CCUnitID>{}(unit.getID()); })
.def(py::self == py::self)
.def("__repr__", [](const Unit & unit) { return "<Unit of type: '" + unit.getType().getName() + "'>"; });
}
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