diff options
author | rubidium <rubidium@openttd.org> | 2009-12-20 12:29:16 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-12-20 12:29:16 +0000 |
commit | ca5a9ab99504e40c1f84d042321371933ebe014d (patch) | |
tree | 0d44b1f12cf1c1a40915055fc6bdaaaa7523937c /src/ai/api | |
parent | 4d781122821f3e834ad668f5616e32f4de2465cf (diff) | |
download | openttd-ca5a9ab99504e40c1f84d042321371933ebe014d.tar.xz |
(svn r18562) -Document: improve clarity of the AIAccounting class
Diffstat (limited to 'src/ai/api')
-rw-r--r-- | src/ai/api/ai_accounting.hpp | 16 |
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(); |