Class that keeps track of the costs, so you can request how much a block of commands did cost in total. More...
Public Member Functions | |
AIAccounting () | |
Creating instance of this class starts counting the costs of commands from zero. | |
~AIAccounting () | |
Restore the AIAccounting that was on top when we created this instance. | |
Money | GetCosts () |
Get the current value of the costs. | |
void | ResetCosts () |
Reset the costs to zero. |
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:
{ local costs = AIAccounting(); BuildRoad(from_here, to_here); BuildRoad(from_there, to_there); print("Costs for route is: " + costs.GetCosts()); }
AIAccounting::AIAccounting | ( | ) |
Creating instance of this class starts counting the costs of commands from zero.
Saves the current value of GetCosts so we can return to the old value when the instance gets deleted.
AIAccounting::~AIAccounting | ( | ) |
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.
Money AIAccounting::GetCosts | ( | ) |
Get the current value of the costs.
void AIAccounting::ResetCosts | ( | ) |
Reset the costs to zero.