From 3e7e386882dc619e96827aecf3542e6a8c98979b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20Bergstr=C3=B6m?= <davbe125@student.liu.se>
Date: Fri, 31 Aug 2018 10:40:53 +0200
Subject: [PATCH] Update documentation on BaseLocation

---
 docs/perception.rst                  | 24 +++++++++++++++++++-----
 python-api-src/lib_base_location.cpp | 12 ++++++------
 2 files changed, 25 insertions(+), 11 deletions(-)

diff --git a/docs/perception.rst b/docs/perception.rst
index 7418c997f..9bbbe07a3 100644
--- a/docs/perception.rst
+++ b/docs/perception.rst
@@ -46,15 +46,29 @@ BaseLocation
    the BaseLocationManager to keep track of all base locations and related
    information.
 
-   .. attribute:: library.BaseLocation.position
+   .. attribute:: position
 
       The position of the center of the BaseLocation, defined as a :class:`library.Point2D`.
-      This is the position used if you want to build a Command Center at the
-      base location.
 
-   .. attribute:: library.BaseLocation.depot_position
+   .. attribute:: depot_position
+
+      A suitable position for building a town hall (Command Center, Hatchery or
+      Nexus), defined as a :class:`library.Point2DI`.
+
+   .. autoattribute:: mineral_fields
+
+   .. autoattribute:: minerals
+
+   .. autoattribute:: geysers
+
+   .. automethod:: get_ground_distance
+
+   .. automethod:: is_occupied_by_player
+
+   .. automethod:: is_player_start_location
+
+   .. automethod:: contains_position
 
-      A suitable position for building a town hall, defined as a :class:`library.Point2DI`.
 
 TechTree
 --------
diff --git a/python-api-src/lib_base_location.cpp b/python-api-src/lib_base_location.cpp
index 39973fd58..6293a37aa 100644
--- a/python-api-src/lib_base_location.cpp
+++ b/python-api-src/lib_base_location.cpp
@@ -5,16 +5,16 @@ namespace py = pybind11;
 void define_base_location(py::module & m)
 {
     py::class_<BaseLocation>(m, "BaseLocation")
-        .def_property_readonly("geysers", &BaseLocation::getGeysers)
-        .def_property_readonly("minerals", &BaseLocation::getMinerals)
+        .def_property_readonly("geysers", &BaseLocation::getGeysers, "List of geysers at base location (List of units)")
+        .def_property_readonly("minerals", &BaseLocation::getMinerals, "List of mineral fields at base location (List of unit)")
         .def_property_readonly("mineral_fields", &BaseLocation::getMinerals, "Alias for minerals in order to differentiate from harvested minerals")
-        .def_property_readonly("is_start_location", &BaseLocation::isStartLocation)
-        .def_property_readonly("depot_position", &BaseLocation::getDepotPosition)
+        .def_property_readonly("is_start_location", &BaseLocation::isStartLocation, "True if the base location is a start location, False otherwise")
+        .def_property_readonly("depot_position", &BaseLocation::getDepotPosition, "Point2DI position suitable for placing a town hall")
         .def_property_readonly("position", &BaseLocation::getPosition)
         .def("get_ground_distance", py::overload_cast<const CCPosition &>(&BaseLocation::getGroundDistance, py::const_))
         .def("get_ground_distance", py::overload_cast<const CCTilePosition &>(&BaseLocation::getGroundDistance, py::const_))
-        .def("is_occupied_by_player", &BaseLocation::isOccupiedByPlayer)
-        .def("is_player_start_location", &BaseLocation::isPlayerStartLocation)
+        .def("is_occupied_by_player", &BaseLocation::isOccupiedByPlayer, "player constant"_a)
+        .def("is_player_start_location", &BaseLocation::isPlayerStartLocation, "player_constant"_a)
         .def("contains_position", &BaseLocation::containsPosition);
 
     py::class_<BaseLocationManager>(m, "BaseLocationManager")
-- 
GitLab