From bd0688d75bd6462f0496c3ea909fc33c62b3d246 Mon Sep 17 00:00:00 2001 From: Chris Beck Date: Tue, 24 Jun 2014 21:42:20 -0400 Subject: [PATCH] add doxygen comments to fake_unit_manager.?pp --- src/fake_unit_manager.cpp | 6 ++++++ src/fake_unit_manager.hpp | 19 ++++++++++--------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/fake_unit_manager.cpp b/src/fake_unit_manager.cpp index 313dfb5dcff3..1c26c649cea4 100644 --- a/src/fake_unit_manager.cpp +++ b/src/fake_unit_manager.cpp @@ -23,6 +23,11 @@ static lg::log_domain log_engine("engine"); #define ERR_NG LOG_STREAM(err, log_engine) +/** Temporarily register a unit to be drawn on the map (moving: can overlap others). + * The temp unit is added at the end of the temporary unit dequeue, + * and therefore gets drawn last, over other units and temp units. + * Adding the same unit twice isn't allowed. + */ void fake_unit_manager::place_temporary_unit(internal_ptr_type u) { if(std::find(fake_units_.begin(),fake_units_.end(), u) != fake_units_.end()) { @@ -33,6 +38,7 @@ void fake_unit_manager::place_temporary_unit(internal_ptr_type u) } } +/** Removes any instances of this unit from the temporary unit database. */ int fake_unit_manager::remove_temporary_unit(internal_ptr_type u) { int removed = 0; diff --git a/src/fake_unit_manager.hpp b/src/fake_unit_manager.hpp index 5eb046ae4fcc..2a00738921c5 100644 --- a/src/fake_unit_manager.hpp +++ b/src/fake_unit_manager.hpp @@ -21,39 +21,40 @@ class display; class unit; class fake_unit_ptr; +///Manages a list of fake units for the display object. class fake_unit_manager { public: + ///Construct a fake unit manager from a display which owns it. fake_unit_manager(display & disp) : fake_units_(), my_display_(disp) {} //Anticipate making place_temporary_unit and remove_temporary_unit private to force exception safety friend class fake_unit_ptr; + //Typedef internal_ptr_type is the object held internally. It should point to a const unit, since const units are drawable. typedef unit const * internal_ptr_type; + + //Typedefs and iterator methods which make this object "boost_foreachable" typedef std::deque::const_iterator iterator; typedef std::deque::const_iterator const_iterator; - iterator begin() { return fake_units_.begin(); } + iterator begin() { return fake_units_.begin(); } iterator end() { return fake_units_.end(); } const_iterator begin() const { return fake_units_.begin(); } const_iterator end() const { return fake_units_.end(); } private: - /** Temporarily place a unit on map (moving: can overlap others). - * The temp unit is added at the end of the temporary unit dequeue, - * and therefore gets drawn last, over other units and temp units. - * Adding the same unit twice isn't allowed. - */ + /** Register a unit with this manager. private, should only be called by fake_unit_ptr. void place_temporary_unit(internal_ptr_type); - /** Removes any instances of this temporary unit from the temporary unit vector. - * Returns the number of temp units deleted (0 or 1, any other number indicates an error). + /** Deregister a unit from this manager. private, should only be called by fake_unit_ptr. + * @return the number of temp units deleted (0 or 1, any other number indicates an error). */ int remove_temporary_unit(internal_ptr_type); /// collection of units destined to be drawn but not put into the unit map std::deque fake_units_; - display & my_display_; + display & my_display_; //!< Reference to my display. The display owns me in a scoped_ptr, so this should never be a dangling reference. }; #endif