(svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
#include "ai_company.hpp"
namespace SQConvert {
/* Allow enums to be used as Squirrel parameters */
template <> AICompany::CompanyIndex GetParam(ForceType<AICompany::CompanyIndex>, HSQUIRRELVM vm, int index) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AICompany::CompanyIndex)tmp; }
template <> int Return<AICompany::CompanyIndex>(HSQUIRRELVM vm, AICompany::CompanyIndex res) { sq_pushinteger(vm, (int32)res); return 1; }
/* 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; }
template <> AICompany &GetParam(ForceType<AICompany &>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AICompany *)instance; }
template <> const AICompany *GetParam(ForceType<const AICompany *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AICompany *)instance; }
template <> const AICompany &GetParam(ForceType<const AICompany &>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AICompany *)instance; }
template <> int Return<AICompany *>(HSQUIRRELVM vm, AICompany *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AICompany", res, NULL, DefSQDestructorCallback<AICompany>); return 1; }
}; // namespace SQConvert
void SQAICompanyRegister(Squirrel *engine) {
DefSQClass <AICompany> SQAICompany("AICompany");
SQAICompany.PreRegister(engine);
SQAICompany.AddConstructor<void (AICompany::*)(), 1>(engine, "x");
SQAICompany.DefSQConst(engine, AICompany::FIRST_COMPANY, "FIRST_COMPANY");
SQAICompany.DefSQConst(engine, AICompany::LAST_COMPANY, "LAST_COMPANY");
SQAICompany.DefSQConst(engine, AICompany::MY_COMPANY, "MY_COMPANY");
SQAICompany.DefSQConst(engine, AICompany::INVALID_COMPANY, "INVALID_COMPANY");
SQAICompany.DefSQStaticMethod(engine, &AICompany::GetClassName, "GetClassName", 1, "x");
SQAICompany.DefSQStaticMethod(engine, &AICompany::ResolveCompanyIndex, "ResolveCompanyIndex", 2, "xi");
SQAICompany.DefSQStaticMethod(engine, &AICompany::SetCompanyName, "SetCompanyName", 2, "xs");
SQAICompany.DefSQStaticMethod(engine, &AICompany::GetCompanyName, "GetCompanyName", 2, "xi");
SQAICompany.DefSQStaticMethod(engine, &AICompany::SetPresidentName, "SetPresidentName", 2, "xs");
SQAICompany.DefSQStaticMethod(engine, &AICompany::GetPresidentName, "GetPresidentName", 2, "xi");
SQAICompany.DefSQStaticMethod(engine, &AICompany::GetCompanyValue, "GetCompanyValue", 2, "xi");
SQAICompany.DefSQStaticMethod(engine, &AICompany::GetBankBalance, "GetBankBalance", 2, "xi");
SQAICompany.DefSQStaticMethod(engine, &AICompany::GetLoanAmount, "GetLoanAmount", 1, "x");
SQAICompany.DefSQStaticMethod(engine, &AICompany::GetMaxLoanAmount, "GetMaxLoanAmount", 1, "x");
SQAICompany.DefSQStaticMethod(engine, &AICompany::GetLoanInterval, "GetLoanInterval", 1, "x");
SQAICompany.DefSQStaticMethod(engine, &AICompany::SetLoanAmount, "SetLoanAmount", 2, "xi");
SQAICompany.DefSQStaticMethod(engine, &AICompany::SetMinimumLoanAmount, "SetMinimumLoanAmount", 2, "xi");
SQAICompany.PostRegister(engine);
}