Skip to content
Snippets Groups Projects
Commit 17a7c40c authored by Rojikku98's avatar Rojikku98
Browse files

Added perspectives and fixed get_player

parent 00585b86
No related branches found
No related tags found
1 merge request!6Added perspectives and fixed get_player
...@@ -38,6 +38,6 @@ void define_replay_unit(py::module & m) ...@@ -38,6 +38,6 @@ void define_replay_unit(py::module & m)
.def_property_readonly("is_carrying_minerals", &ReplayUnit::isCarryingMinerals) .def_property_readonly("is_carrying_minerals", &ReplayUnit::isCarryingMinerals)
.def("__hash__", [](const ReplayUnit & unit) { return std::hash<const sc2::Unit *>{}(unit.getUnitPtr()); }) .def("__hash__", [](const ReplayUnit & unit) { return std::hash<const sc2::Unit *>{}(unit.getUnitPtr()); })
.def(py::self == py::self) .def(py::self == py::self)
.def("__repr__", [](const ReplayUnit & unit) { return "<Unit of type: '" + unit.getTypeName() + "'>"; }) .def("__repr__", [](const ReplayUnit & unit) { return "<Unit of type: '" + unit.getTypeName() +" player: " + std::to_string(unit.getPlayer()) +">"; })
; ;
} }
...@@ -29,7 +29,9 @@ PYBIND11_MODULE(library, m) ...@@ -29,7 +29,9 @@ PYBIND11_MODULE(library, m)
.def("update", &sc2::Coordinator::Update) .def("update", &sc2::Coordinator::Update)
.def("set_real_time", &sc2::Coordinator::SetRealtime) .def("set_real_time", &sc2::Coordinator::SetRealtime)
.def("load_replay_list",&sc2::Coordinator::SetReplayPath, "replay_path"_a) .def("load_replay_list",&sc2::Coordinator::SetReplayPath, "replay_path"_a)
.def("add_replay_observer",&sc2::Coordinator::AddReplayObserver, "replay_observer"_a); .def("add_replay_observer",&sc2::Coordinator::AddReplayObserver, "replay_observer"_a)
.def("set_replay_perspective",&sc2::Coordinator::SetReplayPerspective, "perspective"_a)
;
py::enum_<sc2::Race>(m, "Race") py::enum_<sc2::Race>(m, "Race")
.value("Terran", sc2::Race::Terran) .value("Terran", sc2::Race::Terran)
......
...@@ -55,4 +55,9 @@ ReplayUnit ReplayUnit::getTarget() const ...@@ -55,4 +55,9 @@ ReplayUnit ReplayUnit::getTarget() const
return this_unit; return this_unit;
} }
int ReplayUnit::getPlayer() const
{
return m_unit->owner;
}
...@@ -16,5 +16,7 @@ public: ...@@ -16,5 +16,7 @@ public:
std::string getTypeName() const; std::string getTypeName() const;
bool hasTarget() const; bool hasTarget() const;
ReplayUnit getTarget() const; ReplayUnit getTarget() const;
int getPlayer() const;
}; };
\ No newline at end of file
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