(svn r9453) [NoAI] -Codechange: make a difference between static and non-static methods in the squirrel export script.
/* $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 that handles all company related functions.
*/
class AICompany : public AIObject {
public:
/**
* The name of the class, needed by several sub-processes.
*/
static const char *GetClassName() { return "AICompany"; }
/**
* Set the name of your 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 your company.
* @return the name of your company.
* @note the returned company name must be free'd (C++ only).
*/
char *GetCompanyName();
/**
* Gets the current value of your company.
* @return the current value of your company.
*/
int32 GetCompanyValue();
/**
* Gets the bank balance. In other words, the amount of money you can spent.
* @return the bank balance of your company.
*/
int32 GetBankBalance();
/**
* Gets the amount your company have loaned.
* @return the amount loaned money.
* @post the return value is always non-negative.
* @post GetLoanInterval() is always a multiplier of the return value.
*/
int32 GetLoanAmount();
/**
* Gets the maximum amount your company can loan.
* @return the maximum amount your company can loan.
* @post the return value is always non-negative.
* @post GetLoanInterval() is always a multiplier of the return value.
*/
int32 GetMaxLoanAmount();
/**
* Gets the interval/loan step.
* @return the loan step.
* @post return value is always positive.
*/
int32 GetLoanInterval();
/**
* Sets the amount to loan.
* @param loan the amount to loan (multiplier of GetLoanInterval()).
* @pre loan must be non-negative.
* @pre GetLoanInterval must be a multiplier of loan.
* @pre loan must be below GetMaxLoan().
* @pre loan - GetLoanAmount() + GetBankBalance() must be non-negative.
* @return true if the loan could be set to your requested amount.
*/
bool SetLoanAmount(int32 loan);
};
#ifdef DEFINE_SQUIRREL_CLASS
namespace SQConvert {
/* Allow AICompany to be used as Squirrel parameter */
template <> AICompany *GetParam(ForceType<AICompany *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AICompany *)instance; }
}; // namespace SQConvert
void SQAICompanyRegister(Squirrel *engine) {
DefSQClass <AICompany> SQAICompany("AICompany");
SQAICompany.PreRegister(engine);
SQAICompany.AddConstructor(engine);
SQAICompany.DefSQStaticMethod(engine, &AICompany::GetClassName, "GetClassName");
SQAICompany.DefSQMethod(engine, &AICompany::SetCompanyName, "SetCompanyName");
SQAICompany.DefSQMethod(engine, &AICompany::GetCompanyName, "GetCompanyName");
SQAICompany.DefSQMethod(engine, &AICompany::GetCompanyValue, "GetCompanyValue");
SQAICompany.DefSQMethod(engine, &AICompany::GetBankBalance, "GetBankBalance");
SQAICompany.DefSQMethod(engine, &AICompany::GetLoanAmount, "GetLoanAmount");
SQAICompany.DefSQMethod(engine, &AICompany::GetMaxLoanAmount, "GetMaxLoanAmount");
SQAICompany.DefSQMethod(engine, &AICompany::GetLoanInterval, "GetLoanInterval");
SQAICompany.DefSQMethod(engine, &AICompany::SetLoanAmount, "SetLoanAmount");
SQAICompany.PostRegister(engine);
}
#endif /* DEFINE_SQUIRREL_CLASS */
#endif /* AI_COMPANY_HPP */