src/ai/api/ai_accounting.hpp
author truebrain
Wed, 26 Mar 2008 15:17:40 +0000
branchnoai
changeset 9823 0b7f816cf46f
parent 9596 8af5a1399842
child 9829 80fbe02a4184
permissions -rw-r--r--
(svn r12431) [NoAI] -Add: added AIEventSubsidiaryOffer, which keeps you informed about new Subsidiaries
/* $Id$ */

/** @file ai_accounting.hpp everything to handle AI accounting things */

#ifndef AI_ACCOUNTING_HPP
#define AI_ACCOUNTING_HPP

#include "ai_object.hpp"

/**
 * Class that handles all AI accounting related functions.
 * Example:
 *   {
 *     local costs = AIAccounting();
 *     BuildRoad(from_here, to_here);
 *     BuildRoad(from_there, to_there);
 *     print("Costs for route is: " + costs.GetCosts());
 *   }
 */
class AIAccounting : public AIObject {
private:
	int32 last_costs;
public:
	/**
	 * The name of the class, needed by several sub-processes.
	 */
	static const char *GetClassName() { return "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!
	 */
	AIAccounting();

	/**
	 * Destroying this instance reset the costs to the value it was
	 *   in when the instance was created.
	 */
	~AIAccounting();

	/**
	 * Get the current value of the costs.
	 */
	int32 GetCosts();

	/**
	 * Reset the costs to zero.
	 */
	void ResetCosts();
};

#endif /* AI_ACCOUNTING_HPP */