49 * Reset the costs to zero. |
49 * Reset the costs to zero. |
50 */ |
50 */ |
51 void ResetCosts(); |
51 void ResetCosts(); |
52 }; |
52 }; |
53 |
53 |
54 #ifdef DEFINE_SQUIRREL_CLASS |
|
55 namespace SQConvert { |
|
56 /* Allow AIAccounting to be used as Squirrel parameter */ |
|
57 template <> AIAccounting *GetParam(ForceType<AIAccounting *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIAccounting *)instance; } |
|
58 template <> AIAccounting &GetParam(ForceType<AIAccounting &>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIAccounting *)instance; } |
|
59 template <> const AIAccounting *GetParam(ForceType<const AIAccounting *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIAccounting *)instance; } |
|
60 template <> const AIAccounting &GetParam(ForceType<const AIAccounting &>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIAccounting *)instance; } |
|
61 }; // namespace SQConvert |
|
62 |
|
63 void SQAIAccountingRegister(Squirrel *engine) { |
|
64 DefSQClass <AIAccounting> SQAIAccounting("AIAccounting"); |
|
65 SQAIAccounting.PreRegister(engine); |
|
66 SQAIAccounting.AddConstructor(engine); |
|
67 |
|
68 SQAIAccounting.DefSQStaticMethod(engine, &AIAccounting::GetClassName, "GetClassName", 1, "x"); |
|
69 |
|
70 SQAIAccounting.DefSQMethod(engine, &AIAccounting::GetCosts, "GetCosts", 1, "x"); |
|
71 SQAIAccounting.DefSQMethod(engine, &AIAccounting::ResetCosts, "ResetCosts", 1, "x"); |
|
72 |
|
73 SQAIAccounting.PostRegister(engine); |
|
74 } |
|
75 #endif /* DEFINE_SQUIRREL_CLASS */ |
|
76 |
|
77 #endif /* AI_ACCOUNTING_HPP */ |
54 #endif /* AI_ACCOUNTING_HPP */ |