Changeset - r14010:3a50a3effc46
[Not reviewed]
master
0 1 0
rubidium - 15 years ago 2009-12-20 12:29:16
rubidium@openttd.org
(svn r18562) -Document: improve clarity of the AIAccounting class
1 file changed with 11 insertions and 5 deletions:
0 comments (0 inline, 0 general)
src/ai/api/ai_accounting.hpp
Show inline comments
 
@@ -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 @@ public:
 

	
 
	/**
 
	 * 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();
 

	
0 comments (0 inline, 0 general)