From f35c592c7ec413326e9528916867cebe8f7bb199 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Bergstr=C3=B6m?= <davbe125@student.liu.se> Date: Thu, 2 Aug 2018 09:05:55 +0200 Subject: [PATCH] Resolve/update a few TODOs --- python-api-src/lib_point.cpp | 2 +- python-api-src/lib_unittype.cpp | 2 -- python-api-src/library.cpp | 6 +--- src/MapTools.cpp | 50 +-------------------------------- src/MapTools.h | 1 - 5 files changed, 3 insertions(+), 58 deletions(-) diff --git a/python-api-src/lib_point.cpp b/python-api-src/lib_point.cpp index b6a99086e..6e4684060 100644 --- a/python-api-src/lib_point.cpp +++ b/python-api-src/lib_point.cpp @@ -15,7 +15,7 @@ void define_point(py::module & m) .def(py::self -= py::self) .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) diff --git a/python-api-src/lib_unittype.cpp b/python-api-src/lib_unittype.cpp index 40e2b5abc..935b58c10 100644 --- a/python-api-src/lib_unittype.cpp +++ b/python-api-src/lib_unittype.cpp @@ -6,8 +6,6 @@ void define_unittype(py::module & m) { py::class_<UnitType>(m, "UnitType") .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_property_readonly("unit_typeid", [](UnitType & unit_type) { return static_cast<sc2::UNIT_TYPEID>(unit_type.getAPIUnitType()); }) .def_property_readonly("name", &UnitType::getName) diff --git a/python-api-src/library.cpp b/python-api-src/library.cpp index 73222c244..88cbd87f7 100644 --- a/python-api-src/library.cpp +++ b/python-api-src/library.cpp @@ -35,9 +35,7 @@ PYBIND11_MODULE(library, m) m.attr("PLAYER_ALLY") = py::int_((int) Players::Ally); /* - TODO: These also needs to be defined - - typedef SC2Type<ABILITY_ID> AbilityID; + TODO: BuffID is not defined, defined as following by Blizzard: typedef SC2Type<BUFF_ID> BuffID; */ py::class_<sc2::UnitTypeID>(m, "UnitTypeID") @@ -62,8 +60,6 @@ PYBIND11_MODULE(library, m) // IDABot is a specialization of Agent py::class_<IDABot, PyIDABot, sc2::Agent>(m, "IDABot") .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_step", &IDABot::OnStep) .def("get_all_units", &IDABot::GetAllUnits) diff --git a/src/MapTools.cpp b/src/MapTools.cpp index e04049c96..9adad0de0 100644 --- a/src/MapTools.cpp +++ b/src/MapTools.cpp @@ -160,8 +160,6 @@ void MapTools::onFrame() } } } - - draw(); } void MapTools::computeConnectivity() @@ -606,50 +604,4 @@ float MapTools::terrainHeight(const CCPosition & point) const #else return 0; #endif -} - - -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); - } - } - } -} +} \ No newline at end of file diff --git a/src/MapTools.h b/src/MapTools.h index b3c28b2e2..51f053398 100644 --- a/src/MapTools.h +++ b/src/MapTools.h @@ -41,7 +41,6 @@ public: void onStart(); void onFrame(); - void draw() const; int width() const; int height() const; -- GitLab