changeset 14020:3bf69facb7be draft

(svn r18562) -Document: improve clarity of the AIAccounting class
author rubidium <rubidium@openttd.org>
date Sun, 20 Dec 2009 12:29:16 +0000
parents 83da4695b759
children 53eee9df97d5
files src/ai/api/ai_accounting.hpp
diffstat 1 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/ai/api/ai_accounting.hpp
+++ b/src/ai/api/ai_accounting.hpp
@@ -18,12 +18,14 @@
  * Class that keeps track of the costs, so you can request how much a block of
  *  commands did cost in total. Works in both Execute as in Test mode.
  * Example:
+ * <pre>
  *   {
  *     local costs = AIAccounting();
  *     BuildRoad(from_here, to_here);
  *     BuildRoad(from_there, to_there);
  *     print("Costs for route is: " + costs.GetCosts());
  *   }
+ * </pre>
  */
 class AIAccounting : public AIObject {
 public:
@@ -31,26 +33,30 @@
 
 	/**
 	 * Creating instance of this class starts counting the costs of commands
-	 *   from zero.
-	 * @note when the instance is destroyed, he restores the costs that was
-	 *   current when the instance was created!
+	 *   from zero. Saves the current value of GetCosts so we can return to
+	 *   the old value when the instance gets deleted.
 	 */
 	AIAccounting();
 
 	/**
-	 * Destroying this instance reset the costs to the value it was
-	 *   in when the instance was created.
+	 * Restore the AIAccounting that was on top when we created this instance.
+	 *   So basically restore the value of GetCosts to what it was before we
+	 *   created this instance.
 	 */
 	~AIAccounting();
 
 	/**
 	 * Get the current value of the costs.
 	 * @return The current costs.
+	 * @note when nesting AIAccounting instances all instances' GetCosts
+	 *   will always return the value of the 'top' instance.
 	 */
 	Money GetCosts();
 
 	/**
 	 * Reset the costs to zero.
+	 * @note when nesting AIAccounting instances all instances' ResetCosts
+	 *   will always effect on the 'top' instance.
 	 */
 	void ResetCosts();