truelight@9452: /* $Id$ */ truelight@9452: truelight@9452: /** @file ai_accounting.hpp everything to handle AI accounting things */ truelight@9452: truelight@9452: #ifndef AI_ACCOUNTING_HPP truelight@9452: #define AI_ACCOUNTING_HPP truelight@9452: truelight@9452: #include "ai_object.hpp" truelight@9452: truelight@9452: /** truelight@9452: * Class that handles all AI accounting related functions. truelight@9452: * Example: truelight@9452: * { truelight@9452: * local costs = AIAccounting(); truelight@9452: * BuildRoad(from_here, to_here); truelight@9452: * BuildRoad(from_there, to_there); truelight@9452: * print("Costs for route is: " + costs.GetCosts()); truelight@9452: * } truelight@9452: */ truelight@9452: class AIAccounting : public AIObject { truelight@9452: private: truelight@9452: int32 last_costs; truelight@9452: public: truelight@9452: /** truelight@9529: * The name of the class, needed by several sub-processes. truelight@9529: */ truelight@9529: static const char *GetClassName() { return "AIAccounting"; } truelight@9529: truelight@9529: /** truelight@9452: * Creating instance of this class starts counting the costs of commands truelight@9452: * from zero. truelight@9452: * @note when the instance is destroyed, he restores the costs that was truelight@9452: * current when the instance was created! truelight@9452: */ truelight@9452: AIAccounting(); truelight@9452: truelight@9452: /** truelight@9452: * Destroying this instance reset the costs to the value it was truelight@9452: * in when the instance was created. truelight@9452: */ truelight@9452: ~AIAccounting(); truelight@9452: truelight@9452: /** truelight@9452: * Get the current value of the costs. truelight@9452: */ truelight@9452: int32 GetCosts(); truelight@9452: truelight@9452: /** truelight@9452: * Reset the costs to zero. truelight@9452: */ truelight@9452: void ResetCosts(); truelight@9452: }; truelight@9452: truelight@9452: #endif /* AI_ACCOUNTING_HPP */