src/ai/api/ai_company.hpp
branchnoai
changeset 9427 ef0c109c5661
parent 9425 8eec6d10844a
child 9447 8f3c1bc72204
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ai/api/ai_company.hpp	Thu Mar 15 22:28:14 2007 +0000
@@ -0,0 +1,91 @@
+/* $Id$ */
+
+/** @file ai_company.hpp Everything to query a company's financials and statistics */
+
+#ifndef AI_COMPANY_HPP
+#define AI_COMPANY_HPP
+
+#include "ai_object.hpp"
+
+class AICompany : public AIObject {
+public:
+	/**
+	 * Set the name of the company
+	 * @param name the new name of the company
+	 * @pre name != NULL
+	 * @return true if the command was send without problem
+	 */
+	bool SetCompanyName(const char *name);
+
+	/**
+	 * Get the name of the company
+	 * @return the name of the company
+	 * @note the returned company name must be freed
+	 */
+	char *GetCompanyName();
+
+	/**
+	 * Gets the value of the company
+	 * @return the value of the company
+	 */
+	int32 GetCompanyValue();
+
+	/**
+	 * Gets the bank balance, i.e. the amount of money that can be spent
+	 * @return the bank balance of the company
+	 */
+	int32 GetBankBalance();
+
+	/**
+	 * Gets the amount the company have loaned
+	 * @return the amount loaned
+	 * @post return >= 0
+	 * @post return % this->GetLoanInterval() == 0
+	 */
+	int32 GetLoanAmount();
+
+	/**
+	 * Gets the maximum amount the company can loan
+	 * @return the maximum amount the company can loan
+	 * @post return >= 0
+	 * @post return % this->GetLoanInterval() == 0
+	 */
+	int32 GetMaxLoanAmount();
+
+	/**
+	 * Gets the interval/loan steps
+	 * @return the loan steps
+	 * @post return >= 0
+	 */
+	int32 GetLoanInterval();
+
+	/**
+	 * Sets the amount to loan
+	 * @param loan the amount to load (multitude of GetLoanInterval())
+	 * @pre loan >= 0
+	 * @pre loan % this->GetLoanInterval() == 0
+	 * @pre loan < GetMaxLoan()
+	 * @pre loan - GetLoan() + GetBankBalance() > 0
+	 * @return true if the command was send without a problem
+	 */
+	bool SetLoanAmount(int32 loan);
+};
+
+#ifdef DEFINE_SQUIRREL_CLASS
+void SQAICompanyRegister(Squirrel *engine) {
+	DefSQClass <AICompany> SQAICompany("AICompany");
+	SQAICompany.PreRegister(engine);
+	SQAICompany.AddConstructor(engine);
+	SQAICompany.DefSQFunction(engine, &AICompany::SetCompanyName,   "SetCompanyName");
+	SQAICompany.DefSQFunction(engine, &AICompany::GetCompanyName,   "GetCompanyName");
+	SQAICompany.DefSQFunction(engine, &AICompany::GetCompanyValue,  "GetCompanyValue");
+	SQAICompany.DefSQFunction(engine, &AICompany::GetBankBalance,   "GetBankBalance");
+	SQAICompany.DefSQFunction(engine, &AICompany::GetLoanAmount,    "GetLoanAmount");
+	SQAICompany.DefSQFunction(engine, &AICompany::GetMaxLoanAmount, "GetMaxLoanAmount");
+	SQAICompany.DefSQFunction(engine, &AICompany::GetLoanInterval,  "GetLoanInterval");
+	SQAICompany.DefSQFunction(engine, &AICompany::SetLoanAmount,    "SetLoanAmount");
+	SQAICompany.PostRegister(engine);
+}
+#endif /* SQUIRREL_CLASS */
+
+#endif /* AI_COMPANY_HPP */