diff options
Diffstat (limited to 'src/ai/api/ai_industrytype.hpp.sq')
-rw-r--r-- | src/ai/api/ai_industrytype.hpp.sq | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/ai/api/ai_industrytype.hpp.sq b/src/ai/api/ai_industrytype.hpp.sq index 494566021..938477145 100644 --- a/src/ai/api/ai_industrytype.hpp.sq +++ b/src/ai/api/ai_industrytype.hpp.sq @@ -12,6 +12,10 @@ #include "ai_industrytype.hpp" namespace SQConvert { + /* Allow enums to be used as Squirrel parameters */ + template <> AIIndustryType::SpecialIndustryType GetParam(ForceType<AIIndustryType::SpecialIndustryType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIIndustryType::SpecialIndustryType)tmp; } + template <> int Return<AIIndustryType::SpecialIndustryType>(HSQUIRRELVM vm, AIIndustryType::SpecialIndustryType res) { sq_pushinteger(vm, (int32)res); return 1; } + /* Allow AIIndustryType to be used as Squirrel parameter */ template <> AIIndustryType *GetParam(ForceType<AIIndustryType *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIIndustryType *)instance; } template <> AIIndustryType &GetParam(ForceType<AIIndustryType &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIIndustryType *)instance; } @@ -26,6 +30,9 @@ void SQAIIndustryType_Register(Squirrel *engine) SQAIIndustryType.PreRegister(engine); SQAIIndustryType.AddConstructor<void (AIIndustryType::*)(), 1>(engine, "x"); + SQAIIndustryType.DefSQConst(engine, AIIndustryType::INDUSTRYTYPE_UNKNOWN, "INDUSTRYTYPE_UNKNOWN"); + SQAIIndustryType.DefSQConst(engine, AIIndustryType::INDUSTRYTYPE_TOWN, "INDUSTRYTYPE_TOWN"); + SQAIIndustryType.DefSQStaticMethod(engine, &AIIndustryType::IsValidIndustryType, "IsValidIndustryType", 2, ".i"); SQAIIndustryType.DefSQStaticMethod(engine, &AIIndustryType::GetName, "GetName", 2, ".i"); SQAIIndustryType.DefSQStaticMethod(engine, &AIIndustryType::GetProducedCargo, "GetProducedCargo", 2, ".i"); |