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

Resolve/update a few TODOs

parent 1bd8f057
No related branches found
No related tags found
No related merge requests found
...@@ -15,7 +15,7 @@ void define_point(py::module & m) ...@@ -15,7 +15,7 @@ void define_point(py::module & m)
.def(py::self -= py::self) .def(py::self -= py::self)
.def(py::self *= float()) .def(py::self *= float())
.def(py::self /= float()) .def(py::self /= float())
// TODO: These does not compile // These does not compile, but it is not a good idea to compare floats with floats anyway
//.def(py::self == py::self) //.def(py::self == py::self)
//.def(py::self != py::self) //.def(py::self != py::self)
.def(py::self + py::self) .def(py::self + py::self)
......
...@@ -6,8 +6,6 @@ void define_unittype(py::module & m) ...@@ -6,8 +6,6 @@ void define_unittype(py::module & m)
{ {
py::class_<UnitType>(m, "UnitType") py::class_<UnitType>(m, "UnitType")
.def(py::init<const sc2::UnitTypeID &, IDABot &>()) .def(py::init<const sc2::UnitTypeID &, IDABot &>())
// TODO: Rename this to is_typeid
.def("is_type_id", &UnitType::is, "Check if UnitType is UnitTypeID")
.def(py::self == py::self) .def(py::self == py::self)
.def_property_readonly("unit_typeid", [](UnitType & unit_type) { return static_cast<sc2::UNIT_TYPEID>(unit_type.getAPIUnitType()); }) .def_property_readonly("unit_typeid", [](UnitType & unit_type) { return static_cast<sc2::UNIT_TYPEID>(unit_type.getAPIUnitType()); })
.def_property_readonly("name", &UnitType::getName) .def_property_readonly("name", &UnitType::getName)
......
...@@ -35,9 +35,7 @@ PYBIND11_MODULE(library, m) ...@@ -35,9 +35,7 @@ PYBIND11_MODULE(library, m)
m.attr("PLAYER_ALLY") = py::int_((int) Players::Ally); m.attr("PLAYER_ALLY") = py::int_((int) Players::Ally);
/* /*
TODO: These also needs to be defined TODO: BuffID is not defined, defined as following by Blizzard:
typedef SC2Type<ABILITY_ID> AbilityID;
typedef SC2Type<BUFF_ID> BuffID; typedef SC2Type<BUFF_ID> BuffID;
*/ */
py::class_<sc2::UnitTypeID>(m, "UnitTypeID") py::class_<sc2::UnitTypeID>(m, "UnitTypeID")
...@@ -62,8 +60,6 @@ PYBIND11_MODULE(library, m) ...@@ -62,8 +60,6 @@ PYBIND11_MODULE(library, m)
// IDABot is a specialization of Agent // IDABot is a specialization of Agent
py::class_<IDABot, PyIDABot, sc2::Agent>(m, "IDABot") py::class_<IDABot, PyIDABot, sc2::Agent>(m, "IDABot")
.def(py::init()) .def(py::init())
// TODO: The following 3 are CamelCased, but if the name is changed
// the name used for inheritance in Pyhon stays the same. Weird.
.def("on_game_start", &IDABot::OnGameStart) .def("on_game_start", &IDABot::OnGameStart)
.def("on_step", &IDABot::OnStep) .def("on_step", &IDABot::OnStep)
.def("get_all_units", &IDABot::GetAllUnits) .def("get_all_units", &IDABot::GetAllUnits)
......
...@@ -160,8 +160,6 @@ void MapTools::onFrame() ...@@ -160,8 +160,6 @@ void MapTools::onFrame()
} }
} }
} }
draw();
} }
void MapTools::computeConnectivity() void MapTools::computeConnectivity()
...@@ -606,50 +604,4 @@ float MapTools::terrainHeight(const CCPosition & point) const ...@@ -606,50 +604,4 @@ float MapTools::terrainHeight(const CCPosition & point) const
#else #else
return 0; return 0;
#endif #endif
} }
\ No newline at end of file
void MapTools::draw() const
{
#ifdef SC2API
CCPosition camera = m_bot.Observation()->GetCameraPos();
int sx = (int)(camera.x - 12.0f);
int sy = (int)(camera.y - 8);
int ex = sx + 24;
int ey = sy + 20;
#else
BWAPI::TilePosition screen(BWAPI::Broodwar->getScreenPosition());
int sx = screen.x;
int sy = screen.y;
int ex = sx + 20;
int ey = sy + 15;
#endif
for (int x = sx; x < ex; ++x)
{
for (int y = sy; y < ey; y++)
{
if (!isValidTile((int)x, (int)y))
{
continue;
}
// TODO: This maybe should be restored somehow? (Check git blame)
if (false)
{
std::stringstream ss;
ss << getSectorNumber(x, y);
drawText(CCPosition(Util::TileToPosition(x + 0.5f), Util::TileToPosition(y + 0.5f)), ss.str());
}
if (false)
{
CCColor color = isWalkable(x, y) ? CCColor(0, 255, 0) : CCColor(255, 0, 0);
if (isWalkable(x, y) && !isBuildable(x, y)) { color = CCColor(255, 255, 0); }
if (isBuildable(x, y) && !isDepotBuildableTile(x, y)) { color = CCColor(127, 255, 255); }
drawTile(x, y, color);
}
}
}
}
...@@ -41,7 +41,6 @@ public: ...@@ -41,7 +41,6 @@ public:
void onStart(); void onStart();
void onFrame(); void onFrame();
void draw() const;
int width() const; int width() const;
int height() const; int height() const;
......
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