AIAccounting Class Reference

Class that keeps track of the costs, so you can request how much a block of commands did cost in total. More...

Inheritance diagram for AIAccounting:

AIObject

Public Member Functions

 AIAccounting ()
 Creating instance of this class starts counting the costs of commands from zero.
 ~AIAccounting ()
 Destroying this instance reset the costs to the value it was in when the instance was created.
Money GetCosts ()
 Get the current value of the costs.
void ResetCosts ()
 Reset the costs to zero.

Detailed Description

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()); }


Constructor & Destructor Documentation

AIAccounting::AIAccounting (  ) 

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!


Member Function Documentation

Money AIAccounting::GetCosts (  ) 

Get the current value of the costs.

Returns:
The current costs.


Generated on Tue Jan 5 21:07:01 2010 for OpenTTD NoAI API by  doxygen 1.5.6