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

Enable inheritance of the IDABot class in Python

parent cf5c520a
No related branches found
No related tags found
No related merge requests found
......@@ -23,8 +23,12 @@ PYBIND11_MODULE(library, m)
.def(py::init());
// IDABot is a specialization of Agent
py::class_<IDABot, sc2::Agent>(m, "IDABot")
.def(py::init());
py::class_<IDABot, PyIDABot, sc2::Agent>(m, "IDABot")
.def(py::init())
.def("OnGameStart", &IDABot::OnGameStart)
.def("OnStep", &IDABot::OnStep)
.def("OnStep_UpdateIDABot", &IDABot::OnStep_UpdateIDABot)
.def("GetMyUnits", &IDABot::GetMyUnits);
py::class_<sc2::PlayerSetup>(m, "PlayerSetup");
......
......@@ -19,5 +19,34 @@ public:
}
};
// Defined
class PyIDABot : public IDABot
{
public:
using IDABot::IDABot;
void OnGameStart() override
{
PYBIND11_OVERLOAD(
void,
IDABot,
OnGameStart
);
}
void OnStep() override
{
PYBIND11_OVERLOAD(
void,
IDABot,
OnStep
);
}
void OnStep_UpdateIDABot() override
{
PYBIND11_OVERLOAD(
void,
IDABot,
OnStep_UpdateIDABot
);
}
};
void define_typeenums(pybind11::module & m);
\ No newline at end of file
......@@ -36,7 +36,7 @@ public:
void OnGameStart() override;
void OnStep() override;
void OnStep_UpdateIDABot();
virtual void OnStep_UpdateIDABot();
/*
My stuff
......
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