rubidium@9374: /* $Id$ */ rubidium@9374: rubidium@9374: /** @file ai_company.hpp Everything to query a company's financials and statistics */ rubidium@9374: rubidium@9374: #ifndef AI_COMPANY_HPP rubidium@9374: #define AI_COMPANY_HPP rubidium@9374: rubidium@9374: #include "ai_object.hpp" rubidium@9374: truelight@9447: /** truelight@9447: * Class that handles all company related functions. truelight@9447: */ rubidium@9374: class AICompany : public AIObject { rubidium@9374: public: rubidium@9374: /** truelight@9447: * Set the name of your company. truelight@9447: * @param name the new name of the company. rubidium@9374: * @pre name != NULL truelight@9447: * @return true if the command was send without problem. rubidium@9374: */ rubidium@9374: bool SetCompanyName(const char *name); rubidium@9374: rubidium@9374: /** truelight@9447: * Get the name of your company. truelight@9447: * @return the name of your company. truelight@9447: * @note the returned company name must be free'd (C++ only). rubidium@9374: */ rubidium@9374: char *GetCompanyName(); rubidium@9374: rubidium@9374: /** truelight@9447: * Gets the current value of your company. truelight@9447: * @return the current value of your company. rubidium@9374: */ rubidium@9374: int32 GetCompanyValue(); rubidium@9374: rubidium@9374: /** truelight@9447: * Gets the bank balance. In other words, the amount of money you can spent. truelight@9447: * @return the bank balance of your company. rubidium@9374: */ rubidium@9374: int32 GetBankBalance(); rubidium@9374: rubidium@9374: /** truelight@9447: * Gets the amount your company have loaned. truelight@9447: * @return the amount loaned money. truelight@9448: * @post the return value is always non-negative. truelight@9447: * @post GetLoanInterval() is always a multiplier of the return value. rubidium@9374: */ rubidium@9374: int32 GetLoanAmount(); rubidium@9374: rubidium@9374: /** truelight@9447: * Gets the maximum amount your company can loan. truelight@9447: * @return the maximum amount your company can loan. truelight@9448: * @post the return value is always non-negative. truelight@9447: * @post GetLoanInterval() is always a multiplier of the return value. rubidium@9374: */ rubidium@9374: int32 GetMaxLoanAmount(); rubidium@9374: rubidium@9374: /** truelight@9447: * Gets the interval/loan step. truelight@9447: * @return the loan step. truelight@9447: * @post return value is always positive. rubidium@9376: */ rubidium@9376: int32 GetLoanInterval(); rubidium@9376: rubidium@9376: /** truelight@9447: * Sets the amount to loan. truelight@9447: * @param loan the amount to loan (multiplier of GetLoanInterval()). truelight@9448: * @pre loan must be non-negative. truelight@9447: * @pre GetLoanInterval must be a multiplier of loan. truelight@9447: * @pre loan must be below GetMaxLoan(). truelight@9448: * @pre loan - GetLoanAmount() + GetBankBalance() must be non-negative. truelight@9447: * @return true if the loan could be set to your requested amount. rubidium@9374: */ rubidium@9374: bool SetLoanAmount(int32 loan); rubidium@9374: }; rubidium@9374: truelight@9425: #ifdef DEFINE_SQUIRREL_CLASS truelight@9422: void SQAICompanyRegister(Squirrel *engine) { truelight@9387: DefSQClass SQAICompany("AICompany"); truelight@9397: SQAICompany.PreRegister(engine); truelight@9404: SQAICompany.AddConstructor(engine); truelight@9397: SQAICompany.DefSQFunction(engine, &AICompany::SetCompanyName, "SetCompanyName"); truelight@9397: SQAICompany.DefSQFunction(engine, &AICompany::GetCompanyName, "GetCompanyName"); truelight@9397: SQAICompany.DefSQFunction(engine, &AICompany::GetCompanyValue, "GetCompanyValue"); truelight@9397: SQAICompany.DefSQFunction(engine, &AICompany::GetBankBalance, "GetBankBalance"); truelight@9397: SQAICompany.DefSQFunction(engine, &AICompany::GetLoanAmount, "GetLoanAmount"); truelight@9397: SQAICompany.DefSQFunction(engine, &AICompany::GetMaxLoanAmount, "GetMaxLoanAmount"); truelight@9397: SQAICompany.DefSQFunction(engine, &AICompany::GetLoanInterval, "GetLoanInterval"); truelight@9397: SQAICompany.DefSQFunction(engine, &AICompany::SetLoanAmount, "SetLoanAmount"); truelight@9397: SQAICompany.PostRegister(engine); truelight@9387: } rubidium@9520: #endif /* DEFINE_SQUIRREL_CLASS */ truelight@9387: rubidium@9374: #endif /* AI_COMPANY_HPP */