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

Hash sc2::Unit pointer instead of UnitID

This is the result of some bug-hunting. But I don't know if it makes any
difference. It isn't worse, at least.
parent ddcd5967
No related branches found
No related tags found
No related merge requests found
......@@ -37,7 +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("__hash__", [](const Unit & unit) { return std::hash<const sc2::Unit *>{}(unit.getUnitPtr()); })
.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