From 86e6be46655a50fb2e161904eb669d960923d207 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Bergstr=C3=B6m?= <davbe125@student.liu.se> Date: Tue, 3 Jul 2018 13:14:47 +0200 Subject: [PATCH] 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. --- python-api-src/lib_unit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-api-src/lib_unit.cpp b/python-api-src/lib_unit.cpp index 3ac60ab..fe68d9f 100644 --- a/python-api-src/lib_unit.cpp +++ b/python-api-src/lib_unit.cpp @@ -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() + "'>"; }); } -- GitLab