summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ai/api/ai_accounting.hpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/ai/api/ai_accounting.hpp b/src/ai/api/ai_accounting.hpp
index a42d6675d..216ddabdd 100644
--- 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 @@ 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();