Author: fendrin
Date: Wed Mar  9 12:42:09 2011
New Revision: 48829

URL: http://svn.gna.org/viewcvs/wesnoth?rev=48829&view=rev
Log:
Documented the c++ interface to the [tunnel] feature.

Modified:
    trunk/src/pathfind/teleport.hpp

Modified: trunk/src/pathfind/teleport.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/pathfind/teleport.hpp?rev=48829&r1=48828&r2=48829&view=diff
==============================================================================
--- trunk/src/pathfind/teleport.hpp (original)
+++ trunk/src/pathfind/teleport.hpp Wed Mar  9 12:42:09 2011
@@ -35,45 +35,62 @@
 class teleport_group: public savegame::savegame_config {
 public:
        /*
-        * Used to create the object from a saved file.
+        * Constructs the object from a saved file.
+        * @param cfg   the contents of a [tunnel] tag
         */
        teleport_group(const config& cfg);
+
        /*
-        *
+        * Constructs the object from a config file.
+        * @param cfg           the contents of a [tunnel] tag
+        * @param way_back      inverts the direction of the teleport
         */
        teleport_group(const vconfig& cfg, bool way_back = false);
 
        /*
         * Fills the argument loc_pair if the unit u matches the groups filter.
+        * @param loc_pair              returned teleport_pair if the unit 
matches
+        * @param u                             this unit must match the 
group's filter
+        * @param ignore_units  don't consider zoc and blocking when 
calculating the shorted path between
         */
        void get_teleport_pair(
                          teleport_pair& loc_pair
                        , const unit& u
                        , const bool ignore_units) const;
+
        /*
-        * Returns the unique id of the teleport group.
         * Can be set by the id attribute or is randomly chosen.
+        * @return unique id of the teleport group
         */
        const std::string& get_teleport_id() const;
 
        /*
         * Returns whether the group should always be visible,
         * even for enemy movement under shroud.
+        * @return      visibility of the teleport group
         */
        bool always_visible() const;
 
+       /** Inherited from savegame_config. */
        config to_config() const;
 
 private:
 
-       config cfg_;
-       bool reversed_;
-       std::string id_;
+       config cfg_;            // unexpanded contents of a [tunnel] tag
+       bool reversed_;         // Whether the tunnel's direction is reversed
+       std::string id_;        // unique id of the group
 };
 
 
 class teleport_map {
 public:
+       /*
+        * @param teleport_groups
+        * @param u
+        * @param viewing_team
+        * @param see_all
+        * @param ignore_units
+        */
        teleport_map(
                          const std::vector<teleport_group>& teleport_groups
                        , const unit& u
@@ -81,15 +98,29 @@
                        , const bool see_all
                        , const bool ignore_units);
 
+       /*
+        * Constructs an empty teleport map.
+        */
        teleport_map() :
-               teleport_map_(), sources_(), targets_() {
-       }
-       ;
+               teleport_map_(), sources_(), targets_() {};
 
+       /*
+        * @param adjacents             used to return the adjacent hexes
+        * @param loc                   the map location for which we want to 
know the adjacent hexes
+        */
        void get_adjacents(std::set<map_location>& adjacents, map_location loc) 
const;
+       /*
+        * @param sources       used to return the locations that are an 
entrance of the tunnel
+        */
        void get_sources(std::set<map_location>& sources) const;
+       /*
+        * @param targets       used to return the locations that are an exit 
of the tunnel
+        */
        void get_targets(std::set<map_location>& targets) const;
 
+       /*
+        * @returns whether the teleport_map does contain any defined tunnel
+        */
        bool empty() const {
                return sources_.empty();
        }
@@ -100,6 +131,13 @@
        std::map<std::string, std::set<map_location> > targets_;
 };
 
+/*
+ * @param u                                    The unit that is processed by 
pathfinding
+ * @param viewing_team         The team the player belongs to
+ * @param see_all                      Whether the teleport can be seen below 
shroud
+ * @param ignore_units         Whether to ignore zoc and blocking by units
+ * @returns a teleport_map
+ */
 const teleport_map get_teleport_locations(const unit &u, const team 
&viewing_team,
                bool see_all = false, bool ignore_units = false);
 
@@ -107,13 +145,27 @@
 public:
        manager(const config &cfg);
 
+       /*
+        * @param group         teleport_group to be added
+        */
        void add(const teleport_group &group);
+
+       /*
+        * @param id            id of the teleport_group that is to be removed 
by the method
+        */
        void remove(const std::string &id);
+
+       /*
+        * @return      all registered teleport groups on the game field
+        */
        const std::vector<teleport_group>& get() const;
 
+       /** Inherited from savegame_config. */
        config to_config() const;
 
-       // For unique tunnel IDs
+       /*
+        * @returns the next free unique id for a teleport group
+        */
        std::string next_unique_id();
 private:
        std::vector<teleport_group> tunnels_;


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to