src/ai/api/ai_list_valuator.hpp.sq
author truebrain
Sat, 23 Feb 2008 14:42:07 +0000
branchnoai
changeset 9741 53c1c5850e01
parent 9680 5ed7bbfd51c7
child 9753 7209db94ad12
permissions -rw-r--r--
(svn r12221) [NoAI] -Fix: Register functions are no _Register functions, and always on top of the sort list
9660
d0a430e8310b (svn r10569) [NoAI] -Add: added AIListRandomize as Valuator for all lists to attach a random value to all items
truelight
parents:
diff changeset
     1
#include "ai_list_valuator.hpp"
d0a430e8310b (svn r10569) [NoAI] -Add: added AIListRandomize as Valuator for all lists to attach a random value to all items
truelight
parents:
diff changeset
     2
d0a430e8310b (svn r10569) [NoAI] -Add: added AIListRandomize as Valuator for all lists to attach a random value to all items
truelight
parents:
diff changeset
     3
namespace SQConvert {
d0a430e8310b (svn r10569) [NoAI] -Add: added AIListRandomize as Valuator for all lists to attach a random value to all items
truelight
parents:
diff changeset
     4
	/* Allow AIListRandomize to be used as Squirrel parameter */
d0a430e8310b (svn r10569) [NoAI] -Add: added AIListRandomize as Valuator for all lists to attach a random value to all items
truelight
parents:
diff changeset
     5
	template <> AIListRandomize *GetParam(ForceType<AIListRandomize *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIListRandomize *)instance; }
d0a430e8310b (svn r10569) [NoAI] -Add: added AIListRandomize as Valuator for all lists to attach a random value to all items
truelight
parents:
diff changeset
     6
	template <> AIListRandomize &GetParam(ForceType<AIListRandomize &>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIListRandomize *)instance; }
d0a430e8310b (svn r10569) [NoAI] -Add: added AIListRandomize as Valuator for all lists to attach a random value to all items
truelight
parents:
diff changeset
     7
	template <> const AIListRandomize *GetParam(ForceType<const AIListRandomize *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIListRandomize *)instance; }
d0a430e8310b (svn r10569) [NoAI] -Add: added AIListRandomize as Valuator for all lists to attach a random value to all items
truelight
parents:
diff changeset
     8
	template <> const AIListRandomize &GetParam(ForceType<const AIListRandomize &>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIListRandomize *)instance; }
9680
5ed7bbfd51c7 (svn r10629) [NoAI] -Fix: on returning a class instance which is NULL, do not make a wrapper SQ, but return a NULL pointer too
truelight
parents: 9679
diff changeset
     9
	template <> int Return<AIListRandomize *>(HSQUIRRELVM vm, AIListRandomize *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIListRandomize", res, NULL, DefSQDestructorCallback<AIListRandomize>); return 1; }
9660
d0a430e8310b (svn r10569) [NoAI] -Add: added AIListRandomize as Valuator for all lists to attach a random value to all items
truelight
parents:
diff changeset
    10
}; // namespace SQConvert
d0a430e8310b (svn r10569) [NoAI] -Add: added AIListRandomize as Valuator for all lists to attach a random value to all items
truelight
parents:
diff changeset
    11
9741
53c1c5850e01 (svn r12221) [NoAI] -Fix: Register functions are no _Register functions, and always on top of the sort list
truebrain
parents: 9680
diff changeset
    12
void SQAIListRandomize_Register(Squirrel *engine) {
9660
d0a430e8310b (svn r10569) [NoAI] -Add: added AIListRandomize as Valuator for all lists to attach a random value to all items
truelight
parents:
diff changeset
    13
	DefSQClass <AIListRandomize> SQAIListRandomize("AIListRandomize");
d0a430e8310b (svn r10569) [NoAI] -Add: added AIListRandomize as Valuator for all lists to attach a random value to all items
truelight
parents:
diff changeset
    14
	SQAIListRandomize.PreRegister(engine);
d0a430e8310b (svn r10569) [NoAI] -Add: added AIListRandomize as Valuator for all lists to attach a random value to all items
truelight
parents:
diff changeset
    15
	SQAIListRandomize.AddConstructor<void (AIListRandomize::*)(), 1>(engine, "x");
d0a430e8310b (svn r10569) [NoAI] -Add: added AIListRandomize as Valuator for all lists to attach a random value to all items
truelight
parents:
diff changeset
    16
d0a430e8310b (svn r10569) [NoAI] -Add: added AIListRandomize as Valuator for all lists to attach a random value to all items
truelight
parents:
diff changeset
    17
	SQAIListRandomize.DefSQStaticMethod(engine, &AIListRandomize::GetClassName, "GetClassName", 1, "x");
d0a430e8310b (svn r10569) [NoAI] -Add: added AIListRandomize as Valuator for all lists to attach a random value to all items
truelight
parents:
diff changeset
    18
d0a430e8310b (svn r10569) [NoAI] -Add: added AIListRandomize as Valuator for all lists to attach a random value to all items
truelight
parents:
diff changeset
    19
	SQAIListRandomize.PostRegister(engine);
d0a430e8310b (svn r10569) [NoAI] -Add: added AIListRandomize as Valuator for all lists to attach a random value to all items
truelight
parents:
diff changeset
    20
}